Skip to content

Commit cd55650

Browse files
committed
Fix reusable workflows trigger
1 parent dec44d9 commit cd55650

3 files changed

Lines changed: 74 additions & 16 deletions

File tree

‎.github/workflows/checks.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Checks
22

33
on:
44
workflow_call:
5+
secrets:
6+
rulebooks-pull-token:
7+
required: true
8+
type: string
59

610
env:
711
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
@@ -61,7 +65,7 @@ jobs:
6165
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
6266
with:
6367
repository: fmasa/wfrp-master-rulebooks
64-
token: ${{ secrets.RULEBOOKS_PULL_TOKEN }}
68+
token: ${{ secrets.rulebooks-pull-token }}
6569
path: rulebooks
6670
persist-credentials: false
6771
- name: Setup Rulebooks test config

‎.github/workflows/main.yml‎

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ on:
1111
env:
1212
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
1313

14-
permissions: {}
14+
permissions:
15+
# See checks.yml and releases.yml for rationale
16+
contents: write
17+
pages: write
18+
id-token: write
1519

1620
jobs:
1721
checks:
1822
name: "Checks"
19-
uses: ./.github/checks.yml
23+
uses: ./.github/workflows/checks.yml
24+
with:
25+
rulebooks-pull-token: ${{ secrets.RULEBOOKS_PULL_TOKEN }}
2026

2127
release-master:
2228
name: "Release (testing)"
@@ -32,11 +38,36 @@ jobs:
3238
- uses: ./.github/release.yml
3339
with:
3440
version: ${{ format('dev-{0}', steps.get-short-sha.outputs.id) }}
35-
41+
# Does not deploy desktop version
42+
# Desktop version currently requires existing Github Release to upload
43+
# artifacts.
44+
# TODO: Create pre-release automatically for each commit on master
45+
github-release: false
46+
signing-key: ${{ secrets.SIGNING_KEY }}
47+
keystore-file-base-64: ${{ secrets.KEYSTORE_FILE_BASE64 }}
48+
keystore-password: ${{ secrets.KEYSTORE_PASSWORD }}
49+
key-password: ${{ secrets.KEY_PASSWORD }}
50+
play-store-json-file: ${{ secrets.PLAY_STORE_JSON_FILE }}
51+
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
52+
google-application-credentials-base64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
3653
release-tag:
3754
name: "Release (production)"
3855
if: github.ref_type == 'tag'
3956
needs: [checks]
40-
uses: ./.github/release.yml
57+
uses: ./.github/workflows/release.yml
4158
with:
4259
version: ${{ github.ref_name }}
60+
github-release: true
61+
signing-key: ${{ secrets.SIGNING_KEY }}
62+
keystore-file-base64: ${{ secrets.KEYSTORE_FILE_BASE64 }}
63+
keystore-password: ${{ secrets.KEYSTORE_PASSWORD }}
64+
key-password: ${{ secrets.KEY_PASSWORD }}
65+
play-store-json-file: ${{ secrets.PLAY_STORE_JSON_FILE }}
66+
firebase-token: ${{ secrets.FIREBASE_TOKEN }}
67+
google-application-credentials-base64: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
68+
permissions:
69+
# Matching permissions required by the workflow,
70+
# see the release.yml for rationale
71+
contents: write
72+
pages: write
73+
id-token: write

‎.github/workflows/release.yml‎

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ on:
66
version:
77
required: true
88
type: string
9+
github-release:
10+
required: true
11+
type: boolean
12+
signing-key:
13+
required: true
14+
type: string
15+
keystore-file-base64:
16+
required: true
17+
type: string
18+
keystore-password:
19+
required: true
20+
type: string
21+
key-password:
22+
required: true
23+
type: string
24+
play-store-json-file:
25+
required: true
26+
type: string
27+
firebase-token:
28+
required: true
29+
type: string
30+
google-application-credentials-base64:
31+
required: true
32+
type: string
933

1034
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1135
permissions:
@@ -39,11 +63,12 @@ jobs:
3963
- id: auth
4064
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
4165
with:
42-
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_BASE64 }}
66+
credentials_json: ${{ google-application-credentials-base64 }}
4367
- run: yarn fireway migrate --path firebase-build/migrations
4468

4569
conveyor:
4670
name: "Create desktop distributions"
71+
if: ${{ inputs.github_release }}
4772
needs: [firestore-migrations]
4873
environment:
4974
name: github-pages
@@ -74,7 +99,7 @@ jobs:
7499
uses: hydraulic-software/conveyor/actions/build@7944fcb4085b3519af85a980e8987b5a4d526f20 # v17.0
75100
with:
76101
command: make site
77-
signing_key: ${{ secrets.SIGNING_KEY }}
102+
signing_key: ${{ inputs.signing-key }}
78103
agree_to_license: 1
79104
cache_key: conveyor-${{ matrix.os }}-${{ matrix.arch }}
80105

@@ -87,7 +112,7 @@ jobs:
87112
- name: Upload artifacts to Github Release
88113
env:
89114
GH_TOKEN: ${{ github.token }}
90-
run: gh release upload "$GITHUB_REF_NAME" output/* --clobber
115+
run: gh release upload ${{ inputs.version }} output/* --clobber
91116

92117
- name: Setup Pages
93118
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
@@ -107,9 +132,8 @@ jobs:
107132
container: alvrme/alpine-android:android-34-jdk17
108133
environment: production
109134
env:
110-
KEYSTORE_FILE_BASE64: ${{ secrets.KEYSTORE_FILE_BASE64 }}
111-
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
112-
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
135+
KEYSTORE_PASSWORD: ${{ inputs.keystore-password }}
136+
KEY_PASSWORD: ${{ inputs.key-password }}
113137
steps:
114138
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
115139
with:
@@ -118,9 +142,9 @@ jobs:
118142
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
119143
with:
120144
cache-disabled: true
121-
- run: echo "$KEYSTORE_FILE_BASE64" | base64 -d > app/.keystore
145+
- run: echo ${{ inputs.keystore-file-base64 }} | base64 -d > app/.keystore
122146
- run: echo "SUPPLY_VERSION_CODE=$((950 + $GITHUB_RUN_NUMBER))" >> $GITHUB_ENV
123-
- run: echo "SUPPLY_VERSION_NAME=$(.github/workflows/version.sh)" >> $GITHUB_ENV
147+
- run: echo "SUPPLY_VERSION_NAME=${{ inputs.version }}" >> $GITHUB_ENV
124148
- run: 'echo "version code: $SUPPLY_VERSION_CODE, version name: $SUPPLY_VERSION_NAME"'
125149
- run: ./gradlew bundleRelease
126150
- run: mv app/build/outputs/bundle/release/app-release.aab .
@@ -142,7 +166,6 @@ jobs:
142166
environment: production
143167
env:
144168
PLAY_STORE_TRACK: internal
145-
PLAY_STORE_JSON_FILE: ${{ secrets.PLAY_STORE_JSON_FILE }}
146169
SUPPLY_UPLOAD_MAX_RETRIES: '5'
147170
steps:
148171
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -153,7 +176,7 @@ jobs:
153176
with:
154177
name: bundle
155178
- run: apk add build-base
156-
- run: echo "$PLAY_STORE_JSON_FILE" > fastlane/play_store_credentials.json
179+
- run: echo "${{ inputs.play-store-json-file }}" > fastlane/play_store_credentials.json
157180
- run: bundle install -j $(nproc)
158181
- run: bundle exec fastlane deploy
159182
- run: '[ "$GITHUB_REF_TYPE" = "tag" ] && bundle exec fastlane production || echo "Skipped"'
@@ -165,7 +188,7 @@ jobs:
165188
container: timbru31/java-node:21-jdk-iron
166189
environment: production
167190
env:
168-
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
191+
FIREBASE_TOKEN: ${{ inputs.firebase-token }}
169192
steps:
170193
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
171194
with:

0 commit comments

Comments
 (0)