-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflow): add release mechanism (#10)
Signed-off-by: Swarit Pandey <[email protected]>
- Loading branch information
1 parent
423daa4
commit 1322a0e
Showing
1 changed file
with
43 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,43 @@ | ||
name: Release Workflow | ||
|
||
on: | ||
push: | ||
tags: [ 'v*.*.*' ] | ||
|
||
jobs: | ||
compile-and-commit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Use nodejs | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install deps | ||
run: npm ci | ||
|
||
- name: Build | ||
run: npm run build | ||
id: build | ||
|
||
- name: Commit compiled JS code | ||
if: steps.build.outcome == 'success' | ||
run: | | ||
git config --local user.name 'github-actions[bot]' | ||
git config --local user.email 'github-actions[bot]@users.noreply.github.com' | ||
git checkout ${{ github.ref_name }} # Checkout the specific release tag | ||
git add dist | ||
git commit -m "[bot] Add compiled JS for release ${{ github.ref_name }}" | ||
git push origin ${{ github.ref_name }} # Push to the tag and not to main, this helps to keep track of releases | ||
- name: Handle build failure | ||
if: steps.build.outcome != 'success' | ||
run: | | ||
echo "Build failed. Unable to commit compiled JS code." | ||
echo "Please check the build logs for errors and fix them before re-releasing." | ||
exit 1 |