Skip to content

fix: typo (#1221)

fix: typo (#1221) #571

name: publish-theme
on:
push:
branches:
- master
workflow_dispatch:
jobs:
look_for_change:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
outputs:
theme_changed: ${{ steps.changed-theme-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Check changes in theme
id: changed-theme-files
uses: tj-actions/changed-files@v45
with:
since_last_remote_commit: "true"
files: |
apify-docs-theme/**
publish:
needs: look_for_change
if: ${{ needs.look_for_change.outputs.theme_changed == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'package-lock.json'
always-auth: 'true'
- name: Setup git user and npm
run: |
git config --global user.name "Apify Release Bot"
git config --global user.email "noreply@apify.com"
echo "access=public" > ~/.npmrc
echo "@apify-packages:registry=https://npm.pkg.github.com/" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.APIFY_SERVICE_ACCOUNT_NPM_TOKEN }}" >> ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}" >> ~/.npmrc
- name: Bump the theme version
run: |
cd $GITHUB_WORKSPACE/apify-docs-theme
npm version patch --legacy-peer-deps
- name: Deploy theme to npm
run: |
cd $GITHUB_WORKSPACE/apify-docs-theme
npx -y publish-if-not-exists
env:
GIT_USER: "barjin:${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}"
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
- name: Wait until the new theme version is available on npm
run: |
cd $GITHUB_WORKSPACE/apify-docs-theme
PACKAGE_JSON=$(cat package.json);
PACKAGE_NAME=$(jq -r .name <(echo $PACKAGE_JSON));
PACKAGE_VER=$(jq -r .version <(echo $PACKAGE_JSON));
for i in $(seq 1 10); do
EXIT_CODE=0;
npm show $PACKAGE_NAME@$PACKAGE_VER || EXIT_CODE=1;
if [[ $EXIT_CODE -eq 1 ]]; then
echo "The new package version ($PACKAGE_VER) is not yet available, waiting 30 seconds...";
sleep 30;
continue;
fi;
echo "The new package version ($PACKAGE_VER) is live, proceeding!";
break;
done;
npm show $PACKAGE_NAME@$PACKAGE_VER # fails if the package is not available, succeeds if it is
- name: Commit the new theme version
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'chore: publish new version of @apify/docs-theme [skip ci]'
file_pattern: 'apify-docs-theme/package*.json'
commit_user_name: Apify Bot
commit_user_email: my-github-actions-bot@example.org
commit_author: Apify Bot <apify@apify.com>
rebuild-docs:
needs: publish
strategy:
matrix:
repo:
- apify/apify-sdk-js
- apify/apify-sdk-python
- apify/apify-cli
- apify/apify-client-js
- apify/apify-client-python
runs-on: ubuntu-latest
steps:
- env:
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
run: |
gh workflow run docs.yaml --repo ${{ matrix.repo }}