forked from apify/crawlee
-
Notifications
You must be signed in to change notification settings - Fork 0
201 lines (170 loc) · 8.18 KB
/
Copy pathrelease.yml
File metadata and controls
201 lines (170 loc) · 8.18 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: Release @latest
env:
RETRY_TESTS: 1
on:
workflow_dispatch:
inputs:
version:
description: The version to bump (if you choose custom, please include it under custom version)
required: true
default: 'patch'
type: choice
options:
- 'patch'
- 'minor'
- 'major'
- 'custom'
custom_version:
description: The custom version to bump to (only for "custom" type)
required: false
type: string
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Test before releasing to ensure we don't release a broken version
build_and_test:
name: Build & Test
if: (!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:'))
strategy:
fail-fast: true
matrix:
# We don't test on Windows as the tests are flaky
os: [ ubuntu-22.04 ]
node-version: [ 22, 24, 26 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node-version }}
package-manager-cache: false
- name: Turbo cache
id: turbo-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- uses: apify/workflows/pnpm-install@main
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps
- name: Build
run: pnpm ci:build
- name: Tests
run: pnpm test
release:
name: "Bump Crawlee: ${{ inputs.version }} version (${{ inputs.custom_version || 'n/a' }} custom version)"
if: (!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:'))
needs: build_and_test
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0
- name: Use Node.js 24
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
- name: Turbo cache
id: turbo-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- uses: apify/workflows/pnpm-install@main
- name: Build
run: pnpm ci:build
- name: Bump version to custom version
if: ${{ github.event.inputs.version == 'custom' && github.event.inputs.custom_version != '' }}
run: pnpm exec lerna version ${{ github.event.inputs.custom_version }} --force-publish --yes
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: Apify Release Bot
GIT_COMMITTER_NAME: Apify Release Bot
GIT_AUTHOR_EMAIL: noreply@apify.com
GIT_COMMITTER_EMAIL: noreply@apify.com
- name: Bump version to ${{ github.event.inputs.version }} version
if: ${{ github.event.inputs.version != 'custom' }}
run: pnpm exec lerna version ${{ github.event.inputs.version }} --force-publish --yes
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: Apify Release Bot
GIT_COMMITTER_NAME: Apify Release Bot
GIT_AUTHOR_EMAIL: noreply@apify.com
GIT_COMMITTER_EMAIL: noreply@apify.com
- name: Pin versions in internal dependencies and update lockfile
run: |
pnpm release:pin-versions
pnpm install --no-frozen-lockfile
- name: Commit changes
id: commit
uses: EndBug/add-and-commit@645ecc0dd0a57f4d86d26c0aa5fc42c0a856fbca # v11.0.0
with:
author_name: Apify Release Bot
author_email: noreply@apify.com
message: 'chore(release): update internal dependencies [skip ci]'
pull: '--rebase --autostash'
- name: Publish packages
uses: apify/actions/execute-workflow@v1.4.1
with:
workflow: publish-to-npm.yml
inputs: >
{
"ref": "${{ steps.commit.outputs.commit_long_sha || github.sha }}",
"dist-tag": "prod"
}
- name: Trigger Docker image builds
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
repository: apify/apify-actor-docker
event-type: build-node-images
version-docs:
needs: release
runs-on: ubuntu-22.04
# docs snapshots are only ever generated from master — maintenance branches must not trigger them
if: github.ref == 'refs/heads/master' && (github.event.inputs.version == 'minor' || github.event.inputs.version == 'major')
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.repository.default_branch }}
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
fetch-depth: 0
- name: Use Node.js 24
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
package-manager-cache: false
- name: Install jq
run: sudo apt-get install jq
- uses: apify/workflows/pnpm-install@main
- name: Snapshot the current version
run: |
cd website
VERSION=$(jq -r '.version' ../lerna.json)
if [ -z "$VERSION" ]; then
echo "Error: VERSION is empty. Ensure lerna.json exists and contains a valid .version field."
exit 1
fi
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
MAJOR_MINOR=$(echo $VERSION | cut -d. -f1,2)
pnpm docusaurus docs:version $MAJOR_MINOR
pnpm docusaurus api:version $MAJOR_MINOR
- name: Commit and push the version snapshot
uses: EndBug/add-and-commit@645ecc0dd0a57f4d86d26c0aa5fc42c0a856fbca # v11.0.0
with:
author_name: Apify Release Bot
author_email: noreply@apify.com
message: 'docs: update docs for ${{ env.VERSION }} version'
pull: '--rebase --autostash'