-
Notifications
You must be signed in to change notification settings - Fork 1.2k
97 lines (93 loc) · 3.5 KB
/
update-translated-manual-pages.yml
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
name: Update translated manual pages
on:
workflow_dispatch:
inputs:
force-rebuild:
description: Force re-building all manual pages (e.g. after a script change)
type: boolean
default: false
schedule:
# check daily for updates
- cron: '41 19 * * *'
jobs:
check-for-updates:
concurrency:
group: "pages"
cancel-in-progress: false
if: github.event.repository.fork == false || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
external/docs/sync
script
- uses: actions/github-script@v7
id: get-pending
with:
script: |
const { areTranslatedManualPagesUpToDate } = require('./script/ci-helper.js')
return await areTranslatedManualPagesUpToDate(github)
outputs:
up-to-date: ${{ steps.get-pending.outputs.result }}
update-translated-manual-pages:
needs: [check-for-updates]
if: inputs.force-rebuild == true || needs.check-for-updates.outputs.up-to-date == 'false'
runs-on: ubuntu-latest
permissions:
contents: write # to push changes (if any)
pages: write # to deploy to GitHub Pages
id-token: write # to verify that the deployment source is legit
issues: write # to open tickets upon broken links
environment:
name: github-pages
url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v4
- name: ruby setup
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: clone jnavila/git-html-l10n
run: git clone --bare https://github.com/jnavila/git-html-l10n '${{ runner.temp }}/git-html-l10n'
- name: update translated manual pages
run: |
if test true = '${{ inputs.force-rebuild }}'
then
export RERUN=true
fi
bundle exec ruby script/update-docs.rb '${{ runner.temp }}/git-html-l10n' l10n
- name: commit translated manual pages
id: manual-pages
run: |
mkdir -p external/docs/sync &&
git -C '${{ runner.temp }}/git-html-l10n' rev-parse HEAD >external/docs/sync/git-html-l10n.sha &&
git add external/docs/sync/git-html-l10n.sha &&
git add -A external/docs &&
if test true = '${{ inputs.force-rebuild }}' && git diff-index --cached --quiet HEAD --
then
echo '::notice::Rebuild of the translated manual pages was requested but resulted in no changes' >&2
exit 0
fi &&
git \
-c user.name=${{ github.actor }} \
-c user.email=${{ github.actor }}@noreply.github.com \
commit -m "Update translated manual pages" \
-m 'Updated via the `update-translated-manual-pages.yml` GitHub workflow.' &&
echo "result=modified" >>$GITHUB_OUTPUT
- name: verify that there are no uncommitted changes
run: |
git update-index --refresh &&
if test -n "$(git diff HEAD)$(git ls-files --exclude-standard --other)"
then
echo '::error::there are uncommitted changes!' >&2
git status >&2
exit 1
fi
- name: deploy to GitHub Pages
if: steps.manual-pages.outputs.result != ''
id: deploy
uses: ./.github/actions/deploy-to-github-pages
with:
cloudflare-token: ${{ secrets.CLOUDFLARE_TOKEN }}
cloudflare-zone: ${{ secrets.CLOUDFLARE_ZONE }}