From 83e6de792e427c5df84127bccc0b3f53cf03058a Mon Sep 17 00:00:00 2001 From: Kai Bolay Date: Tue, 20 Jun 2023 16:18:17 -0400 Subject: [PATCH 01/11] make `firebase` the last command in the script The exit code of the script should be the exit code of the `firebase ` command. The easiest way to achieve that is to have `firebase` be the last command in the script. I've removed the (conditional) token deprecation warning output at the end of the script, because it's a duplicate, the warning is still given before the `firebase` command is executed. --- entrypoint.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 64c416d..a9e40e3 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -42,7 +42,3 @@ firebase \ ${RELEASE_NOTES:+ --release-notes "${RELEASE_NOTES}"} \ ${INPUT_RELEASENOTESFILE:+ --release-notes-file "${RELEASE_NOTES_FILE}"} \ $( (( $INPUT_DEBUG )) && printf %s '--debug' ) - -if [ -n "${INPUT_TOKEN}" ] ; then - echo ${TOKEN_DEPRECATED_WARNING_MESSAGE} -fi \ No newline at end of file From 6fbe704a8c1bbfc7f1e21d717014e6dc1dd2cc34 Mon Sep 17 00:00:00 2001 From: Wojciech Zieba Date: Sun, 25 Jun 2023 11:04:34 +0200 Subject: [PATCH 02/11] tests: add fail check in tests suite --- .github/workflows/main.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb8b880..c69f93c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,4 +66,23 @@ jobs: testers: "test@test.com, test2@test2.com" releaseNotesFile: README.md file: ApiDemos-debug.apk + - name: Failure during upload should set failure in action step + id: fail_check + uses: ./ + continue-on-error: true + with: + appId: invalid_app_id + token: ${{secrets.FIREBASE_TOKEN}} + testers: "test@test.com, test2@test2.com" + releaseNotesFile: README.md + file: ApiDemos-debug.apk + - name: Check if previous step failed as expected + run: | + if [[ "${{ steps.fail_check.outcome }}" == 'failure' ]]; then + echo "Previous step failed as expected" + exit 0 + else + echo "Previous step succeeded, when it shouldn't" + exit 1 + fi From 3379bab153ccfcd78ef53e55534ffba096205f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Zi=C4=99ba?= Date: Sat, 9 Sep 2023 20:12:09 +0200 Subject: [PATCH 03/11] feat: add workflow to publish pre-build image (#116) --- .github/workflows/publish_image.yml | 50 +++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/publish_image.yml diff --git a/.github/workflows/publish_image.yml b/.github/workflows/publish_image.yml new file mode 100644 index 0000000..baafc73 --- /dev/null +++ b/.github/workflows/publish_image.yml @@ -0,0 +1,50 @@ +name: Create and publish a Docker image + +# Edited snippet from: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action + +# Configures this workflow to run every time a change is pushed to the branch called `release`. +on: + workflow_dispatch: + +# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. +jobs: + build-and-push-image: + runs-on: ubuntu-latest + # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. + permissions: + contents: read + packages: write + # + steps: + - name: Checkout repository + uses: actions/checkout@v3 + # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + # minimal (short sha) + type=sha + + # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. + # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. + - name: Build and push Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + From 4058af705dd229836f141595cee35049c2e55b2c Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Sat, 9 Sep 2023 20:22:01 +0200 Subject: [PATCH 04/11] feat: use pre-built Docker image from GH registry --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e14ea81..5d4568e 100644 --- a/action.yml +++ b/action.yml @@ -38,4 +38,6 @@ branding: icon: 'send' runs: using: 'docker' - image: 'Dockerfile' + image: docker://ghcr.io/wzieba/firebase-distribution-github-action:sha-3379bab +# Uncomment below for easier debugging +# image: 'Dockerfile' From a3d98e7381d72cad6f2f5b7e0431523c79a3397f Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Sun, 1 Oct 2023 16:21:53 +0200 Subject: [PATCH 05/11] tests: add test case for action outputs --- .github/workflows/main.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c69f93c..32e44fb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,12 +9,30 @@ jobs: - name: Get sample .apk for test purposes run: wget https://github.com/appium/appium/raw/1.10/sample-code/apps/ApiDemos-debug.apk - name: Upload artifact to Firebase Distribution + id: testing_outputs uses: ./ with: appId: ${{secrets.FIREBASE_APP_ID}} token: ${{secrets.FIREBASE_TOKEN}} groups: Testers file: ApiDemos-debug.apk + - name: Assert outputs of previous step are not empty + run: | + echo "${{ steps.testing_outputs.outputs.FIREBASE_CONSOLE_URI }}" + if [[ -z "${{ steps.testing_outputs.outputs.FIREBASE_CONSOLE_URI }}" ]]; then + echo "Console URI is empty" >&2 + exit 1 + fi + echo "${{ steps.testing_outputs.outputs.TESTING_URI }}" + if [[ -z "${{ steps.testing_outputs.outputs.TESTING_URI }}" ]]; then + echo "Testing URI is empty" >&2 + exit 1 + fi + echo "${{ steps.testing_outputs.outputs.BINARY_DOWNLOAD_URI }}" + if [[ -z "${{ steps.testing_outputs.outputs.BINARY_DOWNLOAD_URI }}" ]]; then + echo "Binary download URI is empty" >&2 + exit 1 + fi - name: Upload artifact to Firebase Distribution with release note file uses: ./ with: From 21c48e9d213cc029e77fe52253d9a8f940e1f8e7 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Sun, 1 Oct 2023 16:37:34 +0200 Subject: [PATCH 06/11] feat: export firebase links to GH outputs --- entrypoint.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index a9e40e3..c842ef7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -o pipefail + # Required since https://github.blog/2022-04-12-git-security-vulnerability-announced git config --global --add safe.directory $GITHUB_WORKSPACE @@ -41,4 +43,20 @@ firebase \ --testers "$INPUT_TESTERS" \ ${RELEASE_NOTES:+ --release-notes "${RELEASE_NOTES}"} \ ${INPUT_RELEASENOTESFILE:+ --release-notes-file "${RELEASE_NOTES_FILE}"} \ - $( (( $INPUT_DEBUG )) && printf %s '--debug' ) + $( (( $INPUT_DEBUG )) && printf %s '--debug' ) | +{ + while read -r line; do + echo $line + + if [[ $line == *"View this release in the Firebase console"* ]]; then + CONSOLE_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//') + echo "FIREBASE_CONSOLE_URI=$CONSOLE_URI" >>"$GITHUB_OUTPUT" + elif [[ $line == *"Share this release with testers who have access"* ]]; then + TESTING_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//') + echo "TESTING_URI=$TESTING_URI" >>"$GITHUB_OUTPUT" + elif [[ $line == *"Download the release binary"* ]]; then + BINARY_URI=$(echo "$line" | sed -e 's/.*: //' -e 's/^ *//;s/ *$//') + echo "BINARY_DOWNLOAD_URI=$BINARY_URI" >>"$GITHUB_OUTPUT" + fi + done +} From e85b804ff9735c5786f4cb6328f8cc57e5d44c63 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Sun, 1 Oct 2023 16:45:27 +0200 Subject: [PATCH 07/11] build: update Docker image hash --- action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 5d4568e..06b44f2 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,4 @@ branding: icon: 'send' runs: using: 'docker' - image: docker://ghcr.io/wzieba/firebase-distribution-github-action:sha-3379bab -# Uncomment below for easier debugging -# image: 'Dockerfile' + image: docker://ghcr.io/wzieba/firebase-distribution-github-action:sha-344aa66 From a41b2f7ab3f7c2631b6a73fb2f660b517cef45a9 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Sun, 1 Oct 2023 17:06:16 +0200 Subject: [PATCH 08/11] docs: document outputs in README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 7300c53..8c0c5a9 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,20 @@ Specify the release note path to a plain text file. Flag that can be included to print verbose log output. Default value is `false` +## Outputs + +### `FIREBASE_CONSOLE_URI` + +Link to uploaded release in the Firebase console. + +### `TESTING_URI` + +Link to share release with testers who have access. + +### `BINARY_DOWNLOAD_URI` + +Link to download the release binary (link expires in 1 hour). + ## Sample usage ``` From a3c833504e7ea073a3ca1c9449b5c9bc36701316 Mon Sep 17 00:00:00 2001 From: Charles Verge Date: Sat, 18 Nov 2023 21:59:42 -0400 Subject: [PATCH 09/11] Update README.md Provide instruction on where to locate appId and prevent confusion with project id. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c0c5a9..0cfdf21 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This action uploads artifacts (.apk,.aab or .ipa) to Firebase App Distribution. ### `appId` -**Required** App id can be found on the General Settings page +**Required** App id can be found in the Firebase console in your Projects Settings, under Your apps. It is in the following format 1:1234567890123942955466829:android:1234567890abc123abc123 ### `token` From ee55c44e368761b5b01bb027d8f1cec3d7b525ec Mon Sep 17 00:00:00 2001 From: asa-012 Date: Fri, 28 Mar 2025 12:58:57 +0900 Subject: [PATCH 10/11] Dockerfile: Update base image to node:20-alpine for firebase-tools 14.0.0 compatibility --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e1804ba..5773917 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18-alpine3.15 +FROM node:20-alpine WORKDIR /app COPY . /app From bd494989dd4bec0343f78adee87fe66e48279ad6 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Fri, 28 Mar 2025 07:57:43 +0100 Subject: [PATCH 11/11] Don't use token in tests --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32e44fb..46e2cf4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,9 +13,9 @@ jobs: uses: ./ with: appId: ${{secrets.FIREBASE_APP_ID}} - token: ${{secrets.FIREBASE_TOKEN}} groups: Testers file: ApiDemos-debug.apk + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} - name: Assert outputs of previous step are not empty run: | echo "${{ steps.testing_outputs.outputs.FIREBASE_CONSOLE_URI }}" @@ -37,19 +37,19 @@ jobs: uses: ./ with: appId: ${{secrets.FIREBASE_APP_ID}} - token: ${{secrets.FIREBASE_TOKEN}} groups: Testers releaseNotesFile: README.md file: ApiDemos-debug.apk + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} - name: Upload artifact to Firebase Distribution with debug uses: ./ with: appId: ${{secrets.FIREBASE_APP_ID}} - token: ${{secrets.FIREBASE_TOKEN}} groups: Testers releaseNotesFile: README.md file: ApiDemos-debug.apk debug: true + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} - name: Fetch credential file from secrets id: fetch_credential_file uses: timheuer/base64-to-file@v1 @@ -80,20 +80,20 @@ jobs: uses: ./ with: appId: ${{secrets.FIREBASE_APP_ID}} - token: ${{secrets.FIREBASE_TOKEN}} testers: "test@test.com, test2@test2.com" releaseNotesFile: README.md file: ApiDemos-debug.apk + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} - name: Failure during upload should set failure in action step id: fail_check uses: ./ continue-on-error: true with: appId: invalid_app_id - token: ${{secrets.FIREBASE_TOKEN}} testers: "test@test.com, test2@test2.com" releaseNotesFile: README.md file: ApiDemos-debug.apk + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} - name: Check if previous step failed as expected run: | if [[ "${{ steps.fail_check.outcome }}" == 'failure' ]]; then