Skip to content

Commit 5b575fb

Browse files
committed
Add CD workflow
1 parent 033ffeb commit 5b575fb

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Continuous Delivery
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
name: Create Release
17+
runs-on: ubuntu-latest
18+
19+
# Only run this job if one of the following is true:
20+
# - It was run manually.
21+
# - A PR was merged that was not from Dependabot or a fork.
22+
if: |
23+
github.event_name == 'workflow_dispatch' ||
24+
(
25+
github.event.pull_request.merged == true &&
26+
startsWith(github.head_ref, 'dependabot/') == false &&
27+
github.event.pull_request.head.repo.fork == false
28+
)
29+
30+
outputs:
31+
tag: v${{ steps.tag.outputs.version }}
32+
33+
steps:
34+
- name: Checkout
35+
id: checkout
36+
uses: actions/checkout@v4
37+
with:
38+
fetch-depth: 0
39+
fetch-tags: true
40+
41+
- name: Setup Node.js
42+
id: setup-node
43+
uses: actions/setup-node@v4
44+
with:
45+
cache: npm
46+
node-version-file: .node-version
47+
registry-url: https://registry.npmjs.org/
48+
49+
- name: Install Dependencies
50+
id: install
51+
run: npm ci
52+
53+
- name: Test
54+
id: test
55+
run: npm run ci-test
56+
57+
- name: Tag
58+
id: tag
59+
uses: issue-ops/semver@v2
60+
with:
61+
manifest-path: package.json
62+
workspace: ${{ github.workspace }}
63+
ref: main
64+
65+
- name: Publish
66+
id: publish
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
69+
run: |
70+
npm whoami
71+
npm publish --ignore-scripts --access public
72+
73+
- name: Create Release
74+
id: release
75+
uses: issue-ops/releaser@v2
76+
with:
77+
tag: v${{ steps.tag.outputs.version }}

0 commit comments

Comments
 (0)