-
Notifications
You must be signed in to change notification settings - Fork 4
88 lines (72 loc) · 2.29 KB
/
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
name: CD
on:
push:
branches: [main]
env:
NODE_VERSION: 18.x
jobs:
bump-version:
name: Bump package.json Versions
if: ${{ !startsWith(github.event.head_commit.message, '[CI/CD]') }}
runs-on: ubuntu-latest
outputs:
tag-name: ${{ steps.lib-bump.outputs.newTag }}
steps:
- uses: actions/checkout@v4
with:
# This is a public_repo Github personal access token.
token: ${{ secrets.WORKFLOW_GITHUB_TOKEN }}
- name: Bump dev-app version
id: dev-bump
uses: phips28/[email protected]
with:
tag-prefix: "v"
skip-tag: true
commit-message: "[CI/CD]: bump dev-app to {{version}}"
- name: Bump lib version
id: lib-bump
uses: phips28/[email protected]
with:
tag-prefix: "v"
commit-message: "[CI/CD]: bump lib to {{version}}"
env:
PACKAGEJSON_DIR: projects/politie/ngx-sherlock
github-release:
name: Release on Github
needs: bump-version
if: startsWith(needs.bump-version.outputs.tag-name, 'v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ needs.bump-version.outputs.tag-name }}
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.bump-version.outputs.tag-name }}
npm-release:
name: Release on NPM
needs: bump-version
if: startsWith(needs.bump-version.outputs.tag-name, 'v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.bump-version.outputs.tag-name }}
- name: Use node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install
run: npm ci
- name: Build
run: npm run build:prod
- name: Add token to .npmrc
env:
# This is a granular NPM access token with
# "Packages and scopes" permission "Read and write"
# for the four sherlock packages only.
npmToken: ${{ secrets.WORKFLOW_NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=$npmToken" >> .npmrc
- name: Release
run: npm publish ./dist/politie/ngx-sherlock