Created
June 18, 2025 09:40
-
-
Save logickoder/bf45f0d25a95e4b921675dfb4f4d6cd5 to your computer and use it in GitHub Desktop.
Download artifact from previous successful workflow of the same branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Distribute Latest APK to Firebase | |
on: | |
workflow_dispatch: | |
permissions: | |
actions: read | |
contents: read | |
jobs: | |
distribute: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gh jq | |
- name: Get latest successful build run ID | |
id: get_run | |
run: | | |
run_id=$(gh run list --workflow build.yml --branch ${{ github.ref_name }} --json conclusion,databaseId -L 10 | jq '[.[] | select(.conclusion=="success")][0].databaseId') | |
echo "run_id=$run_id" >> $GITHUB_OUTPUT | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Download latest build artifact | |
run: | | |
gh run download ${{ steps.get_run.outputs.run_id }} -n app -D ./app-artifact | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Upload to Firebase App Distribution | |
uses: wzieba/Firebase-Distribution-Github-Action@v1 | |
with: | |
appId: ${{ secrets.APP_ID }} | |
serviceCredentialsFileContent: ${{ secrets.GCP_CREDENTIAL }} | |
groups: Dev | |
file: ./app-artifact/app-release.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assumptions (you can change when using in your workflow):