Skip to content

Commit fbf8199

Browse files
committed
Update GitHub Actions workflows
Refactor into CI / CD steps adding a distinct release step.
1 parent 93628bb commit fbf8199

1 file changed

Lines changed: 34 additions & 5 deletions

File tree

.github/workflows/main.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
name: Main
1+
name: CI & CD
22

33
on:
4-
push: { branches: [ main ] }
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] # ✊ SemVer tag triggers a CD job.
57
pull_request:
68
workflow_dispatch:
79

10+
# https://docs.github.com/en/actions/using-jobs/using-concurrency
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
815
jobs:
9-
main:
10-
name: Test
16+
17+
ci:
18+
name: Lint & Test
1119
runs-on: ubuntu-latest
1220

1321
steps:
@@ -40,10 +48,31 @@ jobs:
4048
- name: Build
4149
run: pnpm run build
4250

43-
- name: Verify build is up to date
51+
- name: Verify build
4452
run: |
4553
if [ -n "$(git status --porcelain product/dist)" ]; then
4654
echo "Error: product/dist contains uncommitted changes after the build…"
4755
git diff product/dist
4856
exit 1
4957
fi
58+
59+
cd:
60+
name: Release
61+
needs: ci
62+
if: needs.ci.result == 'success' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')))
63+
runs-on: ubuntu-latest
64+
65+
steps:
66+
- name: Checkout Git
67+
uses: actions/checkout@v5
68+
69+
- name: Create GitHub release changelog
70+
id: changelog
71+
uses: metcalfc/changelog-generator@v4.6.2
72+
with:
73+
myToken: ${{ github.token }}
74+
75+
- name: Create GitHub release
76+
uses: softprops/action-gh-release@v2
77+
with:
78+
body: ${{ steps.changelog.outputs.changelog }}

0 commit comments

Comments
 (0)