-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Release Workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- release | ||
|
||
permissions: | ||
contents: write | ||
actions: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build for production | ||
run: npm run build --prod | ||
|
||
- name: Config Git | ||
run: | | ||
git config --global user.name 'GitHub Actions' | ||
git config --global user.email 'actions@github.com' | ||
- name: Tag version | ||
id: tag_version | ||
run: | | ||
# Extract the current version from package.json | ||
VERSION=$(node -p "require('./package.json').version") | ||
# Create a new tag | ||
git tag -a "v$VERSION" -m "Release version $VERSION" | ||
git push origin "v$VERSION" | ||
- name: Update version in file | ||
run: | | ||
# Increment the version in a local file if needed | ||
# For example, incrementing a version number in a VERSION file | ||
VERSION=$(node -p "require('./package.json').version") | ||
echo $VERSION > VERSION | ||
- name: Commit and push version changes | ||
run: | | ||
git add VERSION | ||
git commit -m "Update version to $VERSION" | ||
git push origin release | ||
- name: Merge release into main | ||
run: | | ||
git checkout main | ||
git pull origin main | ||
git merge release | ||
git push origin main |