-
Notifications
You must be signed in to change notification settings - Fork 81
140 lines (122 loc) · 5.28 KB
/
publish-theme.yaml
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
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 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Enable corepack
run: |
corepack enable
- 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 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache-dependency-path: 'package-lock.json'
always-auth: 'true'
- name: Enable corepack
run: |
corepack enable
- name: Setup git user and npm
run: |
git config --global user.name "Apify Release Bot"
git config --global user.email "[email protected]"
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: [email protected]
commit_author: Apify Bot <[email protected]>
rebuild-docs:
needs: publish
strategy:
matrix:
repo:
- apify/apify-sdk-js
- apify/apify-cli
- apify/apify-client-js
runs-on: ubuntu-latest
steps:
- env:
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
run: |
gh workflow run docs.yaml --repo ${{ matrix.repo }}
rebuild-python-docs:
needs: publish
strategy:
matrix:
repo:
- apify/apify-sdk-python
- apify/apify-client-python
runs-on: ubuntu-latest
steps:
- env:
GITHUB_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
run: |
gh workflow run build_and_deploy_docs.yaml --repo ${{ matrix.repo }}