Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,47 @@ 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
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
- 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:
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
Expand Down Expand Up @@ -62,8 +80,27 @@ 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
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
echo "Previous step failed as expected"
exit 0
else
echo "Previous step succeeded, when it shouldn't"
exit 1
fi

50 changes: 50 additions & 0 deletions .github/workflows/publish_image.yml
Original file line number Diff line number Diff line change
@@ -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 }}

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine3.15
FROM node:20-alpine

WORKDIR /app
COPY . /app
Expand Down
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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

```
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ branding:
icon: 'send'
runs:
using: 'docker'
image: 'Dockerfile'
image: docker://ghcr.io/wzieba/firebase-distribution-github-action:sha-344aa66
24 changes: 19 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -41,8 +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' )

if [ -n "${INPUT_TOKEN}" ] ; then
echo ${TOKEN_DEPRECATED_WARNING_MESSAGE}
fi
$( (( $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
}