Update release.yml #38
Workflow file for this run
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
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: 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 config --global user.name 'GitHub Actions' | |
git config --global user.email 'actions@github.com' | |
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 |