-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (80 loc) · 2.14 KB
/
cd.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
95
96
97
98
99
100
101
102
103
104
name: CD
on:
workflow_dispatch:
inputs:
version:
description: A SemVer for the release
default: ""
required: true
type: string
defaults:
run:
shell: pwsh
env:
NODE_VERSION: 20
jobs:
ci:
name: Run CI
uses: ./.github/workflows/ci.yml
with:
version: ${{ inputs.version }}
branch_name: main
secrets: inherit
publish:
name: Publish to npm
needs:
- ci
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: npm ci
- name: Download Build
uses: actions/download-artifact@v4
with:
name: build
path: ./dist
- name: Publish
run: npx nx run-many --target publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
create-release:
name: Create GitHub Release
needs:
- publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Download Build
uses: actions/download-artifact@v4
with:
name: build
path: ./dist
- name: Pack assets
run: npx nx run-many --target pack
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
generate_release_notes: true
files: dist/**.tgz
body: |
# Release v${{ inputs.version }}
Download from [npm](https://www.npmjs.com/package/license-cop/v/${{ inputs.version }}): `npm install license-cop@${{ inputs.version }} --save-dev`