-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (80 loc) · 3.02 KB
/
Copy pathpull-localization.yml
File metadata and controls
102 lines (80 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Pull Localization from Google Sheets
on:
workflow_dispatch: {}
env:
KEY_JSON_PATH: 'SecretCache/UnityLocalizationExtension/service-account-key.json'
BASE_BRANCH: ${{ github.ref_name }}
HEAD_BRANCH: update_stringtablecollection-${{ github.ref_name }}
jobs:
pull-localization-tables:
name: Pull Localization Tables
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Generate Key
shell: bash
run: |
mkdir -p $(dirname "${{ env.KEY_JSON_PATH }}")
echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY_JSON_BASE64 }}" | base64 --decode > "${{ env.KEY_JSON_PATH }}"
- name: Execute PullAllLocalizationTables
uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
projectPath: ./
unityVersion: 2021.3.6f1
targetPlatform: Android
buildMethod: Tsgcpp.Localization.Extension.Example.Editor.ExampleLocalizationSynchronizationMenu.PullAllLocalizationTablesFromTempKeyJson
- name: Delete Key
if: always()
run: |
rm -f "${{ env.KEY_JSON_PATH }}"
- name: Git Commit String Tables
id: commit
shell: bash
run: |
set -eux
git checkout -b ${{ env.HEAD_BRANCH }}
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git reset
git add --update "Assets/Example/StringTableCollection"
DIFF_COUNT=$(git diff --staged --name-only | wc -l)
if [ "${DIFF_COUNT}" -le 0 ]
then
echo "::notice::Skipped the commit becuase no differences were found."
exit 0
fi
DATE=$(date '+%Y/%m/%d %H:%M')
TITLE="Update StringCollectionTable (${DATE})"
git commit -m "${TITLE}"
echo "::set-output name=has_diff::true"
echo "::set-output name=title::${TITLE}"
- name: Git Push ans PullRequest
if: steps.commit.outputs.has_diff == 'true'
shell: bash
run: |
set -eux
REMOTE_SHA=$(git ls-remote --heads origin ${{ env.HEAD_BRANCH }})
if [ -n "${REMOTE_SHA}" ]
then
git push origin --delete ${{ env.HEAD_BRANCH }}
echo "::notice::A already-existing remote branch (ref_name: ${{ env.HEAD_BRANCH }}, sha: ${REMOTE_SHA}) was deleted."
fi
git push origin ${{ env.HEAD_BRANCH }}
sleep 2
PR_URL=$(gh pr create \
--base "${{ env.BASE_BRANCH }}" \
--head "${{ env.HEAD_BRANCH }}" \
--title "[CI] ${{ steps.commit.outputs.title }}" \
--body "" \
)
echo "::notice::${PR_URL} was issued."
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notice
run: |
echo "This is a notification phase"