Skip to content

Commit

Permalink
[gha,release] handle versoning and production mode when releasing fro…
Browse files Browse the repository at this point in the history
…m a tag
  • Loading branch information
nxmatic committed Jul 2, 2024
1 parent e9ebdc3 commit 7fb7874
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Update package version for release
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\/v//')
pnpm version $VERSION --no-git-tag-version
cat <<! | tee -a $GITHUB_ENV
NODE_ENV=production
!
- name: Build
run: pnpm build:chrome

Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,14 @@
"build:chrome:main": "BUILD_ENTRY=main vite build --mode=chrome",
"build:chrome:options": "BUILD_ENTRY=options vite build --mode=chrome",
"build:chrome:popup": "BUILD_ENTRY=popup vite build --mode=chrome",
"build:chrome": "NODE_ENV=development pnpm run env:build chrome && NODE_ENV=development concurrently --kill-others-on-fail 'npm:build:chrome:*'",
"build:chrome": "pnpm run env:build chrome && concurrently --kill-others-on-fail 'npm:build:chrome:*'",
"build:firefox:about": "BUILD_ENTRY=about vite build --mode=firefox",
"build:firefox:content": "BUILD_ENTRY=content vite build --mode=firefox",
"build:firefox:json": "BUILD_ENTRY=json vite build --mode=firefox",
"build:firefox:main": "BUILD_ENTRY=main vite build --mode=firefox",
"build:firefox:options": "BUILD_ENTRY=options vite build --mode=firefox",
"build:firefox:popup": "BUILD_ENTRY=popup vite build --mode=firefox",
"build:firefox": "NODE_ENV=development pnpm run env:build firefox && NODE_ENV=development concurrently --kill-others-on-fail 'npm:build:firefox:*'",
"release:chrome": "pnpm run build:chrome:env && NODE_ENV=production concurrently --kill-others-on-fail 'npm:build:chrome:*'",
"release:firefox": "pnpm run build:firefox:env && NODE_ENV=production concurrently --kill-others-on-fail 'npm:build:firefox:*'"
"build:firefox": "npm run env:build firefox && concurrently --kill-others-on-fail 'npm:build:firefox:*'"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion vite.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const env = {
VITE_BUILD_TIMESTAMP: Date.now(),
VITE_BUILD_VERSION: buildVersion,
VITE_BUILD_VERSION_NAME: buildVersionName,
VITE_DEVELOPMENT_MODE: process.env.NODE_ENV === 'development',
VITE_DEVELOPMENT_MODE: process.env.NODE_ENV !== 'production',
};

const content = Object.entries(env)
Expand Down

0 comments on commit 7fb7874

Please sign in to comment.