Skip to content

Commit 58872ed

Browse files
committed
ci: Add CD workflow to generate semantic version
1 parent 2a5c707 commit 58872ed

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/cd-semver.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Continuous Delivery
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- add-semver-workflow
8+
9+
jobs:
10+
release:
11+
if: contains(github.event.commits[0].message, 'chore(release)') == false
12+
name: Release
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
env:
16+
DRY_RUN: true
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
23+
24+
- name: Release
25+
id: release
26+
uses: ridedott/release-me-action@v3
27+
with:
28+
dry-run: ${{ env.DRY_RUN }}
29+
release-branches: '["main", "add-semver-workflow"]'
30+
commit-assets: |
31+
./dist
32+
release-rules-append: |
33+
[
34+
{ "release": "patch", "type": "build" },
35+
{ "release": "patch", "type": "chore" },
36+
{ "release": false, "type": "chore", "scope": "deps-dev" },
37+
{ "release": "patch", "type": "chore", "scope": "deps-dev", "subject": "bump @zeit/ncc from*" },
38+
{ "release": "patch", "type": "ci" },
39+
{ "release": "patch", "type": "improvement" },
40+
{ "release": "patch", "type": "refactor" },
41+
{ "release": false, "subject": "*\\[skip release\\]*" }
42+
]
43+
44+
- name: Authenticate
45+
if: steps.release.outputs.released == 'true'
46+
uses: actions/checkout@v3
47+
with:
48+
fetch-depth: 1
49+
persist-credentials: true
50+
token: ${{ secrets.DOTTBOTT_TOKEN }}
51+
52+
- uses: actions/checkout@v3
53+
if: steps.release.outputs.released == 'true'
54+
with:
55+
fetch-depth: 1
56+
persist-credentials: true
57+
58+
- name: Tag
59+
if: steps.release.outputs.released == 'true' && env.DRY_RUN == 'false'
60+
run: |
61+
git push origin :refs/tags/'v${{ steps.release.outputs.major }}'
62+
git tag 'v${{ steps.release.outputs.major }}' --force
63+
git push --tags

0 commit comments

Comments
 (0)