Skip to content

Commit 912b175

Browse files
authored
ci: add l10n workflows (#167)
1 parent 204fe77 commit 912b175

6 files changed

Lines changed: 128 additions & 6 deletions

File tree

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build
2-
on: [push, pull_request]
2+
3+
on:
4+
push:
5+
pull_request:
36

47
jobs:
58
build:
@@ -17,4 +20,4 @@ jobs:
1720
- uses: actions/upload-artifact@v4
1821
with:
1922
name: Artifacts ${{ matrix.java }}
20-
path: build/libs/
23+
path: build/libs/

.github/workflows/l10n-pull.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This workflow is based on work originally published under the MIT License, and available here:
2+
# <https://github.com/modrinth/code/blob/efcc0d87b5621ac4c9656ee3967d28b5903a8fe9/.github/workflows/i18n-pull.yml>
3+
# The required copyright notice and the full text of the license, which apply to the original file, are reported below.
4+
5+
# Copyright 2025 Rinth, Inc.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8+
#
9+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10+
#
11+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12+
13+
name: Pull from Crowdin
14+
15+
on:
16+
schedule:
17+
- cron: 37 7 * * SAT
18+
workflow_dispatch:
19+
20+
concurrency:
21+
group: l10n-pull
22+
23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
27+
jobs:
28+
l10n-pull:
29+
runs-on: ubuntu-24.04
30+
steps:
31+
- if: startsWith(github.ref_name, 'l10n/')
32+
run: |
33+
echo "::error title=Wrong Branch::This workflow must not be triggered from the l10n/* branch"
34+
exit 1
35+
- uses: actions/checkout@v4
36+
- uses: crowdin/github-action@60debf382ee245b21794321190ad0501db89d8c1
37+
with:
38+
token: ${{ secrets.CROWDIN_TOKEN }}
39+
crowdin_branch_name: ${{ github.event.repository.name }}/${{ github.ref_name }}
40+
upload_sources: false
41+
upload_translations: false
42+
download_sources: false
43+
download_translations: true
44+
create_pull_request: false
45+
push_translations: false
46+
- run: sudo chown -R "${USER}:${USER}" .
47+
- run: git fetch --depth=1 origin "l10n/${{ github.ref_name }}" || true
48+
- id: message
49+
run: |
50+
prefix="l10n: $(date +%y)w$(date +%V)"
51+
52+
old_message="$(git show --no-patch --pretty=format:%s "origin/l10n/${{ github.ref_name }}" || true)"
53+
regex="^${prefix}([a-z]+)"
54+
if [[ "${old_message}" =~ ${regex} ]]; then
55+
old_suffix="${BASH_REMATCH[1]}"
56+
if [[ "${old_suffix}" =~ z$ ]]; then
57+
suffix="${old_suffix%?}oa"
58+
else
59+
last_char="$(tr "a-y" "b-z" <<<"${old_suffix: -1}")"
60+
suffix="${old_suffix%?}${last_char}"
61+
fi
62+
else
63+
suffix="a"
64+
fi
65+
66+
echo message="${prefix}${suffix}" >>"${GITHUB_OUTPUT}"
67+
- uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725
68+
with:
69+
title: ${{ steps.message.outputs.message }}
70+
body: ""
71+
commit-message: ${{ steps.message.outputs.message }}
72+
author: Fabric Bot <159731069+FabricMCBot@users.noreply.github.com>
73+
branch: l10n/${{ github.ref_name }}
74+
draft: always-true
75+
maintainer-can-modify: false

.github/workflows/l10n-push.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow is based on work originally published under the MIT License, and available here:
2+
# <https://github.com/modrinth/code/blob/efcc0d87b5621ac4c9656ee3967d28b5903a8fe9/.github/workflows/i18n-push.yml>
3+
# The required copyright notice and the full text of the license, which apply to the original file, are reported below.
4+
5+
# Copyright 2025 Rinth, Inc.
6+
#
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8+
#
9+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10+
#
11+
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12+
13+
name: Push to Crowdin
14+
15+
on:
16+
push:
17+
branches: [main]
18+
paths:
19+
- ".github/workflows/l10n-push.yaml"
20+
- "crowdin.yaml"
21+
- "src/main/resources/lang/installer.properties"
22+
workflow_dispatch:
23+
24+
concurrency:
25+
group: l10n-push
26+
27+
jobs:
28+
l10n-push:
29+
runs-on: ubuntu-24.04
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: crowdin/github-action@60debf382ee245b21794321190ad0501db89d8c1
33+
with:
34+
token: ${{ secrets.CROWDIN_TOKEN }}
35+
crowdin_branch_name: ${{ github.event.repository.name }}/${{ github.ref_name }}
36+
upload_sources: true
37+
upload_translations: false
38+
download_sources: false
39+
download_translations: false
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Release
2-
on: [workflow_dispatch] # Manual trigger
2+
3+
on:
4+
workflow_dispatch:
5+
36
jobs:
47
build:
58
runs-on: ubuntu-24.04
@@ -17,4 +20,4 @@ jobs:
1720
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
1821
SIGNING_SERVER: ${{ secrets.SIGNING_SERVER }}
1922
SIGNING_PGP_KEY: ${{ secrets.SIGNING_PGP_KEY }}
20-
SIGNING_JAR_KEY: ${{ secrets.SIGNING_JAR_KEY }}
23+
SIGNING_JAR_KEY: ${{ secrets.SIGNING_JAR_KEY }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
!/settings.gradle
1919
!/checkstyle.xml
2020
!/.editorconfig
21-
!/crowdin.yml
21+
!/crowdin.yaml

crowdin.yml renamed to crowdin.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ files:
22
- source: src/main/resources/lang/installer.properties
33
translation: /src/main/resources/lang/installer_%locale_with_underscore%.properties
44
escape_quotes: 0
5-
escape_special_characters: 0
5+
escape_special_characters: 0
6+
preserve_hierarchy: true
7+
project_id: "647524"

0 commit comments

Comments
 (0)