-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow file to automatically create POT file updates when the b…
…ook is updated
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: build-book | ||
|
||
# Only run this when the main branch changes a markdown file or a top level config file | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'chapters/**.md' | ||
- '_*.yml' | ||
|
||
# This job installs dependencies, builds translation files, and makes a PR to update the POTs | ||
jobs: | ||
push-translations: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
# Install dependencies | ||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: '3.10' | ||
mamba-version: "*" | ||
channels: conda-forge,defaults | ||
channel-priority: true | ||
activate-environment: bioimage-book | ||
environment-file: environment.yml | ||
|
||
# Update the files | ||
- name: Update the files | ||
run: | | ||
sphinx-build -b gettext . locales/_build/gettext | ||
- name: Push translations to a branch (branch protection) | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git checkout -b auto_translation | ||
git add "**.pot" | ||
git commit -m "auto generated translation file updates" | ||
git push -u origin auto_translation | ||
gh pr create --title "Auto-translations" --body "Made by GH Actions" |