Skip to content

Commit

Permalink
feat: add Tag Build CI (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamhunter2333 authored Apr 12, 2024
1 parent 58ad025 commit 0c5365d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/tag_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Tag Build CI

on:
push:
tags:
- "*"

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Build Frontend
run: cd frontend && pnpm install --no-frozen-lockfile && pnpm build:release

- name: Build Backend
run: cd worker && pnpm install --no-frozen-lockfile && pnpm build

- name: Upload to Release
uses: softprops/action-gh-release@v2
with:
files: |
frontend/dist/*
worker/dist/*
tag_name: ${{ steps.get_version.outputs.VERSION }}
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"scripts": {
"dev": "vite",
"build": "vite build -m prod --emptyOutDir",
"build:release": "vite build -m example --emptyOutDir",
"preview": "vite preview",
"deploy": "npm run build && wrangler pages deploy ../dist --branch production"
"deploy": "npm run build && wrangler pages deploy ./dist --branch production"
},
"dependencies": {
"@vicons/material": "^0.12.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import topLevelAwait from "vite-plugin-top-level-await";
// https://vitejs.dev/config/
export default defineConfig({
build: {
outDir: '../dist',
outDir: './dist',
},
plugins: [
vue(),
Expand Down
3 changes: 2 additions & 1 deletion worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy",
"start": "wrangler dev"
"start": "wrangler dev",
"build": "wrangler deploy --dry-run --outdir dist --minify"
},
"devDependencies": {
"wrangler": "^3.48.0"
Expand Down

0 comments on commit 0c5365d

Please sign in to comment.