Merge pull request #1053 from pljones/ctrlmidich-improved-doc #2912
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: Jekyll site CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ next-release, release ] | |
push: | |
branches: [ next-release ] | |
paths: | |
- 'wiki/en/**' | |
jobs: | |
jekyll_site_ci: | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
# Paths changes filter. Detects if there's been a change to any files defined in the filter: | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
base: ${{ github.ref }} | |
filters: | | |
src_files_changed: | |
- 'wiki/en/**' | |
# Retrieve po4a installation cache or create it if not found: | |
- name: Check for po4a cache | |
uses: actions/cache@v4 | |
id: cache-po4a | |
with: | |
path: "~/po4a" | |
key: ${{ runner.os }}-po4a-0.68 | |
- name: Install or retrieve po4a from cache | |
env: | |
CACHE_HIT: ${{steps.cache-po4a.outputs.cache-hit}} | |
# If CACHE_HIT: true, retrieve the cache. If not, install po4a and its dependencies and copy them all to a folder (~/po4a/) to be cached: | |
run: ./_po4a-tools/po4a-cache.sh | |
# If there have been changes to English source files in /wiki, run po4a-update-templates: | |
- name: Update .po files | |
if: ${{ steps.filter.outputs.src_files_changed == 'true' }} | |
run: ./_po4a-tools/po4a-update-templates.sh | |
# This step only runs if a PR is merged: | |
- name: Push changes to repo if action triggered on:push and .po files need updating | |
if: ${{ ( github.event_name == 'push' && steps.filter.outputs.src_files_changed == 'true' ) || ( github.event_name == 'workflow_dispatch' && steps.filter.outputs.src_files_changed == 'true' ) }} | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: 'AUTO: Updated .po files' | |
# Create target translated files. Never pushed to the repo. | |
- name: Create translated docs and stats | |
if: ${{ github.event_name == 'pull_request' }} | |
run: ./_po4a-tools/po4a-create-all-targets.sh | |
# Build, zip and upload site only when triggered by PR to avoid duplicating checks and uploads: | |
- name: Build the site in the jekyll/builder container | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
docker run \ | |
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \ | |
jekyll/builder:latest /bin/bash -c "chmod a+w /srv/jekyll/Gemfile.lock && chmod 777 /srv/jekyll && jekyll build --future" | |
- name: Zip Website | |
if: ${{ github.event_name == 'pull_request' }} | |
run: zip -r ${{ github.workspace }}/website.zip _site/* | |
- uses: actions/upload-artifact@v4 | |
name: Upload Website | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
name: Website | |
path: ${{ github.workspace }}/website.zip | |
retention-days: 15 | |
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` |