Skip to content

[Refactor] Release Process - Steps for a Specific Release #142

[Refactor] Release Process - Steps for a Specific Release

[Refactor] Release Process - Steps for a Specific Release #142

Workflow file for this run

name: Add new language
on:
issues:
types: [ labeled ]
jobs:
add_new_language:
permissions:
contents: write
issues: write
runs-on: ubuntu-latest
if: github.event.label.name == 'new language'
steps:
# Check whether the language has been written correctly:
- name: Check issue title format
env:
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_NUM: ${{ github.event.issue.number }}
run: |
LANG_CODE=$(sed 's/.*\[\([^]]*\)].*/\1/' <<< "$ISSUE_TITLE")
FULL_LANG=$(sed 's/.*<\([^>]*\)>.*/\1/' <<< "$ISSUE_TITLE")
if [[ "$LANG_CODE" =~ ^[a-z]{2}(-[A-Z]{2})?$ ]]; then
if echo "$ISSUE_TITLE" | grep -q '<[^>]\+>'; then
echo "lang_code=$LANG_CODE" >> $GITHUB_ENV
echo "full_lang=$FULL_LANG" >> $GITHUB_ENV
echo "issue_num=$ISSUE_NUM" >> $GITHUB_ENV
else
echo Error: language name in wrong format.
exit 1
fi
else
echo Error: language code in wrong format.
exit 1
fi
# Check out repo:
- uses: actions/checkout@v4
with:
ref: next-release
# Check if language has been added previously.
- name: Check if language is already present
run: |
if [ -d "_translator-files/po/${{ env.lang_code }}" ] ; then
echo Error: The language [${{ env.lang_code }}] seems to already exist.
exit 1
else
echo Language: [${{ env.lang_code }}] seems to be new as no Language: [${{ env.lang_code }}] was found. Proceeding to add [${{ env.lang_code }}].
fi
# Check po4a cache. 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:
- name: Check for po4a cache
uses: actions/cache@v4
id: cache-po4a
with:
path: "~/po4a"
key: ${{ runner.os }}-po4a-0.68
- name: Install/retrieve po4a from cache
env:
CACHE_HIT: ${{ steps.cache-po4a.outputs.cache-hit }}
run: ./_po4a-tools/po4a-cache.sh
# Create dirs and files for new language:
- name: Create po files, non-wiki dirs, screenshots and symlinks for new lang
run: ./_po4a-tools/po4a-add-language.sh
# Push changes to 'next-release':
- name: Push changes to repo
uses: EndBug/add-and-commit@v9
with:
branch: next-release
default_author: github_actions
message: 'AUTO: Add new language: ${{ env.lang_code }}: ${{ env.full_lang }} #${{ env.issue_num }}'
# Add comment to issue informing of the creation of the language files:
- name: Add comment to issue
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ env.issue_num }}
body: |
- The .po files have been created for **${{ env.full_lang }}** and are now available on [Weblate](https://hosted.weblate.org/projects/jamulus/#languages). If you prefer not to use Weblate and intend to submit translations via a Pull Request, your language files can be found on the `next-release` branch in `_translator-files/po/${{ env.lang_code }}/`.
- Please consult [this README file](https://github.com/jamulussoftware/jamuluswebsite/tree/next-release/_translator-files#readme) for more information on the translation process.
# Create target translated files. Never pushed to the repo.
- name: Create translated docs
run: ./_po4a-tools/po4a-create-all-targets.sh
# Build site
- name: Build the site in the jekyll/builder container
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"