Reputation: 11419
I'm using GitHub Actions to run the CI for an Android app project. I have a workflow that works well. It runs on PRs and it runs the tests and builds the app.
I have reused the workflow code to build a new one that I put in a different yml
file in the same folder.
The difference is that this workflow has a workflow_dispatch
as event. It also takes one input. It runs the tests and then it will publish the build on Goolge Play or Firebase. For now I'm just using some echo
to log what's happening.
Reading the documentation I was expecting to see a button to manually trigger the workflow from the GitHub UI.
I don't see the workflow when I click on the Action tab and so I don't see the button.
If I make a mistake like for example I delete all the jobs then I see the workflow because I get failed run
. The button is not visible anyway.
name: Publish On CI
on:
workflow_dispatch:
inputs:
publish:
description: 'Choose where you want to publish the build'
required: true
default: AppTester
type: choice
options:
- GooglePlay
- AppTester
- Both
env:
ANDROID_KEYS_FOLDER: ..
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: decode keys
run: echo "${{ secrets.APP_PROPERTIES_BASE64 }}" | base64 > app.properties
echo "${{ secrets.APP_RELEASE_BASE64 }}" | base64 > app-release
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run Unit test
run: ./gradlew testStagingUnitTest
- name: Build
run: ./gradlew :app:assembleStaging
- name: Publish on Google Play if required
if: inputs.publish == 'GooglePlay'
run: echo "Publishing on Google Play"
- name: Publish on Firebase if required
if: inputs.publish == 'AppTester'
run: echo "Publishing on Firebase"
- name: Publish on Google Play and Firebase if required
if: inputs.publish == 'Both'
run: echo "Publishing on Google Play and Firebase"
Upvotes: 6
Views: 10697
Reputation: 1
Also, once when the default runs once, then you can now trigger the workflow_dispatch on other branches. You just need to run it once on the main branch.
Upvotes: 0
Reputation: 23270
A workflow with the workflow_dispatch
trigger needs to exist on the repository default branch to appear on the Github User Interface Actions
tab.
Upvotes: 11