-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (37 loc) · 1.22 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Release Workflow
on:
push:
tags: [ 'v*.*.*' ]
jobs:
compile-and-commit:
runs-on: ubuntu-latest
permissions:
contents: write
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 --force dist
git commit -m "[bot] Add compiled JS for release ${{ github.ref_name }}"
git push origin HEAD:${{ github.ref_name }} --force # 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