Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hidragos committed Sep 11, 2024
1 parent 7fe600e commit d349c38
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
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

0 comments on commit d349c38

Please sign in to comment.