Fix add-lang script 2 (#1021) #691
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: Build/deploy jekyll site and sync release to next-release | |
on: | |
push: | |
branches: | |
- release | |
jobs: | |
build_and_deploy_site: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Retrieve po4a installation cache or create it if not found: | |
- name: Check for po4a cache | |
uses: actions/cache@v3 | |
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 | |
# Paths changes filter. If there's been a change to any files defined in the filter, the step (update .po files) runs: | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
base: ${{ github.ref }} | |
filters: | | |
src_files_changed: | |
- 'wiki/en/**' | |
- 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: ${{ steps.filter.outputs.src_files_changed == 'true' }} | |
uses: EndBug/add-and-commit@v7 | |
with: | |
default_author: github_actions | |
message: 'AUTO: Update .po files' | |
# Create target translated files. Never pushed to the repo. | |
- name: Create translated docs and stats | |
run: ./_po4a-tools/po4a-create-all-targets.sh | |
# Build and deploy site | |
- name: 💎 setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 # can change this to 2.7 or whatever version you prefer | |
- name: 🔨 install dependencies & build site | |
uses: limjh16/jekyll-action-ts@v2 | |
with: | |
enable_cache: true | |
### Enables caching. Similar to https://github.com/actions/cache. | |
# | |
#format_output: false | |
### Uses prettier https://prettier.io to format jekyll output HTML. | |
# | |
# prettier_opts: '{ "useTabs": true }' | |
### Sets prettier options (in JSON) to format output HTML. For example, output tabs over spaces. | |
### Possible options are outlined in https://prettier.io/docs/en/options.html | |
# | |
# prettier_ignore: 'about/*' | |
### Ignore paths for prettier to not format those html files. | |
### Useful if the file is exceptionally large, so formatting it takes a while. | |
### Also useful if HTML compression is enabled for that file / formatting messes it up. | |
# | |
# jekyll_src: sample_site | |
### If the jekyll website source is not in root, specify the directory. (in this case, sample_site) | |
### By default, this is not required as the action searches for a _config.yml automatically. | |
# | |
# gem_src: sample_site | |
### By default, this is not required as the action searches for a _config.yml automatically. | |
### However, if there are multiple Gemfiles, the action may not be able to determine which to use. | |
### In that case, specify the directory. (in this case, sample_site) | |
### | |
### If jekyll_src is set, the action would automatically choose the Gemfile in jekyll_src. | |
### In that case this input may not be needed as well. | |
# | |
# key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
# restore-keys: ${{ runner.os }}-gems- | |
### In cases where you want to specify the cache key, enable the above 2 inputs | |
### Follows the format here https://github.com/actions/cache | |
# | |
# custom_opts: '--drafts --lsi' | |
### If you need to specify any Jekyll build options, enable the above input | |
### Flags accepted can be found here https://jekyllrb.com/docs/configuration/options/#build-command-options | |
- name: 🚀 deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_site | |
# if the repo you are deploying to is <username>.github.io, uncomment the line below. | |
# if you are including the line below, make sure your source files are NOT in the main branch: | |
# publish_branch: main | |
sync-branch: | |
needs: build_and_deploy_site | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: ${{ github.sha }} update from release | |
uses: devmasx/[email protected] | |
with: | |
type: now | |
from_branch: release | |
target_branch: next-release | |
github_token: ${{ github.token }} |