Update translated manual pages #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
sparse-checkout: | | |
_sync_state | |
script | |
- uses: actions/github-script@v6 | |
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 || 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 | |
environment: | |
name: github-pages | |
url: ${{ steps.deploy.outputs.url }} | |
steps: | |
- uses: actions/checkout@v3 | |
- 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: | | |
test false = '${{ inputs.force-rebuild }}' || export RERUN=true | |
bundle exec ruby script/update-docs.rb '${{ runner.temp }}/git-html-l10n' l10n | |
- name: commit translated manual pages | |
id: manual-pages | |
run: | | |
git -C '${{ runner.temp }}/git-html-l10n' rev-parse HEAD >_sync_state/git-html-l10n.sha && | |
git add _sync_state/git-html-l10n.sha && | |
git add -A content/docs && | |
if test false != '${{ 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" && | |
echo "result=modified" >>$GITHUB_OUTPUT | |
- name: deploy to GitHub Pages | |
if: steps.manual-pages.outputs.result != '' | |
id: deploy | |
uses: ./.github/actions/deploy-to-github-pages |