|
1 | 1 | # This workflow runs for every pull request to lint and test the proposed changes. |
2 | 2 |
|
3 | | -name: Check & Release |
| 3 | +name: Check |
4 | 4 |
|
5 | 5 | on: |
6 | 6 | # Push to master will deploy a beta version |
|
25 | 25 | node-version: [18, 20, 22] |
26 | 26 |
|
27 | 27 | steps: |
28 | | - - name: Cancel Workflow Action |
29 | | - |
30 | | - with: |
31 | | - access_token: ${{ github.token }} |
32 | | - |
33 | 28 | - uses: actions/checkout@v4 |
34 | 29 |
|
35 | 30 | - name: Use Node.js ${{ matrix.node-version }} |
@@ -128,6 +123,7 @@ jobs: |
128 | 123 | cd website |
129 | 124 | yarn |
130 | 125 | yarn build |
| 126 | +
|
131 | 127 | lint: |
132 | 128 | name: Lint |
133 | 129 | runs-on: ubuntu-latest |
@@ -158,123 +154,3 @@ jobs: |
158 | 154 |
|
159 | 155 | - name: Run format checks |
160 | 156 | run: yarn format |
161 | | - |
162 | | - # The deploy job is long but there are only 2 important parts. NPM publish |
163 | | - # and triggering of docker image builds in the apify-actor-docker repo. |
164 | | - deploy: |
165 | | - name: Publish to NPM |
166 | | - if: github.repository_owner == 'apify' && (github.ref == 'refs/heads/master' || github.event_name == 'release') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'docs:') |
167 | | - needs: [build_and_test, test_python_support, lint] |
168 | | - runs-on: ubuntu-latest |
169 | | - steps: |
170 | | - - uses: actions/checkout@v4 |
171 | | - with: |
172 | | - token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} |
173 | | - fetch-depth: 0 |
174 | | - |
175 | | - - name: Use Node.js 20 |
176 | | - uses: actions/setup-node@v4 |
177 | | - with: |
178 | | - node-version: 20 |
179 | | - registry-url: https://registry.npmjs.org |
180 | | - |
181 | | - - name: Enable corepack |
182 | | - run: | |
183 | | - corepack enable |
184 | | - corepack prepare yarn@stable --activate |
185 | | -
|
186 | | - - name: Activate cache for Node.js 20 |
187 | | - uses: actions/setup-node@v4 |
188 | | - with: |
189 | | - cache: yarn |
190 | | - |
191 | | - - name: Set git identity |
192 | | - run: | |
193 | | - git config --global user.name 'Apify Service Account' |
194 | | - git config --global user.email '[email protected]' |
195 | | -
|
196 | | - - name: Install Dependencies |
197 | | - run: yarn |
198 | | - |
199 | | - # Determine if this is a beta or latest release |
200 | | - - name: Set Release Tag |
201 | | - run: echo "RELEASE_TAG=$(if [ ${{ github.event_name }} = release ]; then echo latest; else echo beta; fi)" >> $GITHUB_ENV |
202 | | - |
203 | | - # Check version consistency and increment pre-release version number for beta only. |
204 | | - - name: Bump pre-release version |
205 | | - if: env.RELEASE_TAG == 'beta' |
206 | | - run: yarn tsx ./.github/scripts/before-beta-release.ts |
207 | | - |
208 | | - - name: Publish to NPM |
209 | | - run: | |
210 | | - yarn config set npmAuthToken ${NODE_AUTH_TOKEN} |
211 | | - yarn npm publish --tag ${{ env.RELEASE_TAG }} --access public |
212 | | - env: |
213 | | - NODE_AUTH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }} |
214 | | - |
215 | | - # Latest version is tagged by the release process so we only tag beta here. |
216 | | - - name: Tag Version |
217 | | - if: env.RELEASE_TAG == 'beta' |
218 | | - run: | |
219 | | - git_tag=v`node -p "require('./package.json').version"` |
220 | | - git tag $git_tag |
221 | | - git push origin $git_tag |
222 | | -
|
223 | | - - name: Update readme |
224 | | - if: env.RELEASE_TAG == 'latest' |
225 | | - run: | |
226 | | - git update-index --assume-unchanged .yarnrc.yml |
227 | | - git add . |
228 | | - git diff-index --quiet HEAD || git commit -m "[skip ci] update README with latest command reference" |
229 | | - git push origin HEAD:master |
230 | | -
|
231 | | - update_homebrew_formula: |
232 | | - name: Update Homebrew Formula |
233 | | - needs: [deploy] |
234 | | - runs-on: ubuntu-latest |
235 | | - if: github.repository_owner == 'apify' && github.event_name == 'release' && github.event.action == 'published' |
236 | | - steps: |
237 | | - - name: Checkout repository |
238 | | - uses: actions/checkout@v4 |
239 | | - |
240 | | - - name: Set git identity |
241 | | - run: | |
242 | | - git config --global user.name 'Apify Service Account' |
243 | | - git config --global user.email '[email protected]' |
244 | | -
|
245 | | - - name: Set up Homebrew |
246 | | - uses: Homebrew/actions/setup-homebrew@master |
247 | | - |
248 | | - # It can happen that the updated package version is not available right after the `npm publish` command finishes |
249 | | - # Try waiting 3 minutes until the updated package version is available |
250 | | - - name: Wait for updated package to be available on NPM |
251 | | - run: | |
252 | | - PACKAGE_VERSION=`node -p "require('./package.json').version"` |
253 | | - PACKAGE_DEFINITION_URL="https://registry.npmjs.org/apify-cli/${PACKAGE_VERSION}" |
254 | | -
|
255 | | - for _i in {1..30}; do |
256 | | - curl -sf "${PACKAGE_DEFINITION_URL}" &> /dev/null && exit 0; |
257 | | - echo "Package 'apify-cli' version '${PACKAGE_VERSION}' is not available yet, will retry in 10 seconds." |
258 | | - sleep 10; |
259 | | - done |
260 | | - curl -sf "${PACKAGE_DEFINITION_URL}" &> /dev/null || exit 1; |
261 | | -
|
262 | | - - name: Update Homebrew formula in apify/homebrew-tap repo |
263 | | - run: | |
264 | | - PACKAGE_VERSION=`node -p "require('./package.json').version"` |
265 | | - gh workflow run update_formula.yaml --repo apify/homebrew-tap --field package=apify-cli --field version=$PACKAGE_VERSION |
266 | | - env: |
267 | | - GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} |
268 | | - |
269 | | - - name: Send PR with formula update to homebrew/homebrew-core repo |
270 | | - run: | |
271 | | - PACKAGE_VERSION=`node -p "require('./package.json').version"` |
272 | | - brew tap --force homebrew/core |
273 | | - brew bump-formula-pr apify-cli \ |
274 | | - --version ${PACKAGE_VERSION} \ |
275 | | - --no-browse \ |
276 | | - --message "Automatic update of the \`apify-cli\` formula. |
277 | | -
|
278 | | - CC @B4nan @vladfrangu" |
279 | | - env: |
280 | | - HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} |
0 commit comments