@@ -37,8 +37,44 @@ concurrency:
37 cancel-in-progress: false
37 cancel-in-progress: false
41+ # A job of its own, so that no secret value is registered in the job that writes the release
42+ # notes: the runner drops any job output that contains a secret's value (a key alias like
43+ # "release" would otherwise blank the notes).
44+ name: Check the secrets
45+ runs-on: ubuntu-latest
47+ signed: ${{ steps.s.outputs.signed }}
49+ - name: Check the secrets
52+ DRY_RUN: ${{ inputs.dry_run }}
53+ APP_ID: ${{ secrets.MULTIGRAM_APP_ID }}
54+ APP_HASH: ${{ secrets.MULTIGRAM_APP_HASH }}
55+ KEYSTORE_BASE64: ${{ secrets.MULTIGRAM_KEYSTORE_BASE64 }}
56+ KEYSTORE_PASSWORD: ${{ secrets.MULTIGRAM_KEYSTORE_PASSWORD }}
57+ KEY_ALIAS: ${{ secrets.MULTIGRAM_KEY_ALIAS }}
60+ # Stop here, in seconds, rather than after the long build. A dry run only warns.
61+ problem() { if [ "$DRY_RUN" = true ]; then echo "::warning::$1"; else echo "::error::$1"; exit 1; fi; }
62+ if [ -z "$APP_ID" ] || [ -z "$APP_HASH" ]; then
63+ problem "The MULTIGRAM_APP_ID and MULTIGRAM_APP_HASH secrets are not set, so the APK could not log in. Add them (Settings > Secrets and variables > Actions) and run this again."
65+ if [ -n "$KEYSTORE_BASE64" ]; then
66+ if [ -z "$KEYSTORE_PASSWORD" ] || [ -z "$KEY_ALIAS" ]; then
67+ problem "MULTIGRAM_KEYSTORE_BASE64 is set, but MULTIGRAM_KEYSTORE_PASSWORD or MULTIGRAM_KEY_ALIAS is not: signing would fail at the end of the build. Add both."
69+ echo "signed=true" >> "$GITHUB_OUTPUT"
71+ echo "::warning::No MULTIGRAM_KEYSTORE_BASE64 secret: the release will be signed with Forkgram's public test key and published as a pre-release."
72+ echo "signed=false" >> "$GITHUB_OUTPUT"
41 name: Work out the version
76 name: Work out the version
42 runs-on: ubuntu-latest
78 runs-on: ubuntu-latest
44 sha: ${{ steps.v.outputs.sha }}
80 sha: ${{ steps.v.outputs.sha }}
@@ -58,9 +94,7 @@ jobs:
58 NUMBER: ${{ inputs.number }}
94 NUMBER: ${{ inputs.number }}
59 PRERELEASE: ${{ inputs.prerelease }}
95 PRERELEASE: ${{ inputs.prerelease }}
60 DRY_RUN: ${{ inputs.dry_run }}
96 DRY_RUN: ${{ inputs.dry_run }}
61− APP_ID: ${{ secrets.MULTIGRAM_APP_ID }}
97+ SIGNED: ${{ needs.check_secrets.outputs.signed }}
62− APP_HASH: ${{ secrets.MULTIGRAM_APP_HASH }}
63− KEYSTORE_BASE64: ${{ secrets.MULTIGRAM_KEYSTORE_BASE64 }}
65 set -euo pipefail
99 set -euo pipefail
66 fail() { echo "::error::$1"; exit 1; }
100 fail() { echo "::error::$1"; exit 1; }
@@ -97,17 +131,9 @@ jobs:
97 fg_version=${fg_version:-unknown}; tg_version=${tg_version:-unknown}
131 fg_version=${fg_version:-unknown}; tg_version=${tg_version:-unknown}
100− if [ -z "$APP_ID" ] || [ -z "$APP_HASH" ]; then
101− m="The MULTIGRAM_APP_ID and MULTIGRAM_APP_HASH secrets are not set, so the APK could not log in. Add them (Settings > Secrets and variables > Actions) and run this again."
102− if [ "$DRY_RUN" = true ]; then echo "::warning::$m"; else fail "$m"; fi
104− signed=true
134+ signed=${SIGNED:-false}
105− [ -n "$KEYSTORE_BASE64" ] || signed=false
106 prerelease=$PRERELEASE
135 prerelease=$PRERELEASE
107− if [ "$signed" = false ]; then
108− prerelease=true
136+ [ "$signed" = true ] || prerelease=true
109− echo "::warning::No MULTIGRAM_KEYSTORE_BASE64 secret: MultiGram $version will be signed with Forkgram's public test key and published as a pre-release."
112 notes=$(mktemp)
138 notes=$(mktemp)
@@ -151,7 +177,7 @@ jobs:
153 name: Build
179 name: Build
154− needs: prepare
180+ needs: [check_secrets, prepare]
155 if: ${{ !inputs.dry_run }}
181 if: ${{ !inputs.dry_run }}
156 uses: ./.github/workflows/build.yml
182 uses: ./.github/workflows/build.yml