Update translated manual pages #9
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 _generated-asciidoc/ data/docs.yml 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: 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 |