-
Notifications
You must be signed in to change notification settings - Fork 38
136 lines (120 loc) · 4.22 KB
/
node-release.yaml
File metadata and controls
136 lines (120 loc) · 4.22 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: "[impit-node] Release to npm"
env:
DEBUG: napi:*
APP_NAME: impit-node
MACOSX_DEPLOYMENT_TARGET: '10.13'
RUSTFLAGS: '--cfg reqwest_unstable'
permissions:
contents: write
id-token: write
on:
workflow_dispatch:
inputs:
bump:
description: 'Bump version'
required: true
type: choice
default: 'patch'
options:
- 'major'
- 'minor'
- 'patch'
jobs:
test:
name: Build and test
uses: ./.github/workflows/node-test.yaml
secrets: inherit
publish:
outputs:
bumped-version-commit-sha: ${{ steps.commit.outputs.commit_long_sha || github.sha }}
new_version: ${{ steps.get-new-version.outputs.TARGET_VERSION }}
defaults:
run:
working-directory: impit-node
name: Publish
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Install pnpm and dependencies
uses: apify/workflows/pnpm-install@main
with:
working-directory: impit-node
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
path: artifacts
- name: Move artifacts
run: pnpm artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Calculate version
id: get-new-version
run: |
echo "TARGET_VERSION=$(pnpm dlx semver --increment ${{ github.event.inputs.bump }} $(npm show impit version))" >> "$GITHUB_OUTPUT"
- name: Set version
run: |
pnpm version --no-git-tag-version ${{ steps.get-new-version.outputs.TARGET_VERSION }}
pnpm copy-version
- name: Publish to npm
run: pnpm publish --no-git-checks --provenance
- name: Update lockfile
run: |
for i in $(seq 1 5); do
pnpm install --lockfile-only && exit 0
[ $i -lt 5 ] && echo "Attempt $i failed, waiting 30s before retry..." && sleep 30
done
exit 1
- name: Commit changes
id: commit
uses: EndBug/add-and-commit@v10
with:
author_name: Apify Release Bot
author_email: noreply@apify.com
message: "chore(js-release): Update package version [skip ci]"
tag: "js-${{ steps.get-new-version.outputs.TARGET_VERSION }}"
pull: '--rebase --autostash'
changelog:
name: Generate changelog
needs: [publish]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0
ref: master
- name: Generate a changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --ignore-tags="(py|cli)-*" --include-path="./impit-node/**" --include-path="./impit/**"
env:
OUTPUT: impit-node/CHANGELOG.md
GITHUB_REPO: ${{ github.repository }}
- name: Commit new changelog
id: commit_changelog
uses: EndBug/add-and-commit@v10
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
message: "docs: update changelog [skip ci]"
add: 'impit-node/CHANGELOG.md'
pull: '--rebase --autostash'
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: "js-${{ needs.publish.outputs.new_version }}"
name: "impit-node@${{ needs.publish.outputs.new_version }}"
target_commitish: ${{ needs.publish.outputs.bumped-version-commit-sha }}
body: ${{ steps.git-cliff.outputs.content }}