-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (93 loc) · 3.88 KB
/
github-create-release.yml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Create NPM package
on:
push:
jobs:
run-tests:
# only run if specific '#build' tag is found in commit message
if: contains(github.event.head_commit.message, '#build')
name: "Run tests"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# this is important to make sure that tokens are not reused in subsequent steps
# -> removeing this will cause the "GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }}" to
# reuse the token from the previous step although defined otherwise
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 22
registry-url: https://npm.pkg.github.com/
scope: "@openaip"
- run: npm install
name: Install packages
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
- run: npm run test
publish:
name: "Build and publish package"
needs: run-tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# this is important to make sure that tokens are not reused in subsequent steps
# -> removeing this will cause the "GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }}" to
# reuse the token from the previous step although defined otherwise
with:
persist-credentials: false
- uses: actions/setup-node@v3
with:
node-version: 22
registry-url: https://registry.npmjs.org
scope: '@openaip'
- run: npm install
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
- run: npm run build
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
- id: bump-version
uses: phips28/gh-action-bump-version@master
name: Bump package version
env:
GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }}
with:
major-wording: "#build-major"
minor-wording: "#build-minor"
patch-wording: "#build-patch"
# use "patch" as default bump strategy
default: patch
tag-prefix: "v"
- uses: actions/create-release@v1
name: Create release
env:
GITHUB_TOKEN: ${{ secrets.AUTOMATOR_DEVOPS_PAT }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{steps.bump-version.outputs.newTag}}
release_name: Release ${{steps.bump-version.outputs.newTag}}
body: |
Various fixes and performance improvements.
draft: false
prerelease: false
# publish to GitHub Package Registry for internal use with @openaip namespace
- uses: actions/setup-node@v3
with:
node-version: 22
registry-url: https://npm.pkg.github.com/
scope: '@openaip'
- run: npm publish
name: Publish to GitHub Package Registry
env:
NODE_AUTH_TOKEN: ${{secrets.AUTOMATOR_DEVOPS_PAT}}
# publish to NPM for public access
- uses: actions/setup-node@v3
with:
node-version: 22
registry-url: https://registry.npmjs.org
scope: '@openaip'
- run: npm publish --access public
name: Publish to NPM Package Registry
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
permissions:
contents: write