mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
89 lines
3.1 KiB
YAML
89 lines
3.1 KiB
YAML
name: Update Translation Source
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- '.ci/update_translation_source_strings.sh'
|
|
- '.github/workflows/translations-push.yml'
|
|
schedule:
|
|
# Runs at the start of each quarter (UTC)
|
|
- cron: '0 0 1 1,4,7,10 *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
translations:
|
|
name: "Push strings"
|
|
# Do not run the scheduled workflow on forks
|
|
if: github.event_name != 'schedule' || github.repository_owner == 'Cockatrice'
|
|
runs-on: ubuntu-slim # https://github.com/actions/runner-images/blob/main/images/ubuntu-slim/ubuntu-slim-Readme.md
|
|
|
|
steps:
|
|
- name: "Checkout repo"
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: "Install lupdate"
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends qttools5-dev-tools
|
|
|
|
- name: "Update Cockatrice translation source"
|
|
env:
|
|
FILE: cockatrice/cockatrice_en@source.ts
|
|
id: cockatrice
|
|
shell: bash
|
|
run: |
|
|
DIRS="cockatrice/src $(find . -maxdepth 1 -type d -name 'libcockatrice_*')"
|
|
.ci/update_translation_source_strings.sh
|
|
|
|
- name: "Update Oracle translation source"
|
|
id: oracle
|
|
shell: bash
|
|
env:
|
|
DIRS: oracle/src
|
|
FILE: oracle/oracle_en@source.ts
|
|
run: .ci/update_translation_source_strings.sh
|
|
|
|
- name: "Render template"
|
|
id: template
|
|
uses: chuhlomin/render-template/binary@a7c644e341797d050d1cb24332d83791b9a46dae # v1.12
|
|
with:
|
|
template: .ci/update_translation_source_strings_template.md
|
|
vars: |
|
|
cockatrice_output: ${{ steps.cockatrice.outputs.output }}
|
|
oracle_output: ${{ steps.oracle.outputs.output }}
|
|
commit: ${{ github.sha }}
|
|
|
|
- name: "Create pull request"
|
|
if: github.event_name != 'pull_request'
|
|
id: create_pr
|
|
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
with:
|
|
add-paths: |
|
|
cockatrice/cockatrice_en@source.ts
|
|
oracle/oracle_en@source.ts
|
|
author: github-actions <github-actions@github.com> # owner of the commit
|
|
body: ${{ steps.template.outputs.result }}
|
|
branch: ci-update_translation_source
|
|
commit-message: Update translation source strings
|
|
delete-branch: true
|
|
draft: false
|
|
labels: |
|
|
CI
|
|
Translation
|
|
title: 'Update source strings'
|
|
|
|
- name: "PR Status"
|
|
if: github.event_name != 'pull_request'
|
|
shell: bash
|
|
env:
|
|
PR_NUMBER: ${{ steps.create_pr.outputs.pull-request-number }}
|
|
PR_URL: ${{ steps.create_pr.outputs.pull-request-url }}
|
|
STATUS: ${{ case(steps.create_pr.outputs.pull-request-operation == 'none', 'unchanged', steps.create_pr.outputs.pull-request-operation) }}
|
|
run: |
|
|
echo "PR #$PR_NUMBER $STATUS!" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "URL: $PR_URL" >> "$GITHUB_STEP_SUMMARY"
|