forked from Snazzah/davey
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (90 loc) · 2.61 KB
/
node-release.yml
File metadata and controls
93 lines (90 loc) · 2.61 KB
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
name: "[davey-node] Release to npm"
env:
DEBUG: napi:*
APP_NAME: davey
MACOSX_DEPLOYMENT_TARGET: '10.13'
CARGO_INCREMENTAL: '1'
permissions:
contents: write
id-token: write
'on':
workflow_dispatch:
jobs:
test:
name: Build and test
uses: ./.github/workflows/node-ci.yml
secrets: inherit
publish:
name: Publish
needs: [test]
runs-on: ubuntu-latest
defaults:
run:
working-directory: davey-node
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v5
- name: setup pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: ./davey-node/package.json
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: ./davey-node/pnpm-lock.yaml
- name: Install dependencies
run: pnpm install
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
path: ./davey-node/artifacts
- name: Create npm dirs
run: pnpm napi create-npm-dirs
- name: Move artifacts
run: pnpm artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
npm config set provenance true
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --access public
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Capture package version
id: set-version
shell: bash
run: |
VERSION=$(node -p 'require("./package.json").version')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
release:
name: Create release
needs: [publish]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --unreleased --strip all --ignore-tags="(py|rs)-*" --include-path="./davey-node/**" --include-path="./davey/**"
env:
OUTPUT: davey-node/CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: "js-${{ needs.publish.outputs.version }}"
name: "davey-node@${{ needs.publish.outputs.version }}"
target_commitish: ${{ github.sha }}
body_path: davey-node/CHANGELOG.md