Flutter codebase to APK build in GitHub Actions returns 'undefined: No tag found in ref or input!'
550
As per the notes you either need to specify an existing tag or specify a branch or commit for the commit
input of the action, based on which a tag will be created:
- You must provide a tag either via the action input or the git ref (i.e push / create a tag). If you do not the action will fail.
- If the tag of the release you are creating does not exist yet, you should set both the
tag
andcommit
action inputs.commit
can point to a commit hash or a branch name (ex -main
).
from https://github.com/ncipollo/release-action#notes
Using the following will give you a new version tag with every run, where the last place of the version is incremented for every run.
[...]
# now relase the just created build
- name: Create a Release APK
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/release/*.apk"
token: ${{ secrets.TOKEN }}
commit: master
tag: v1.0.${{ github.run_number }}
Author by
Zach Smith
I am trying to learn...everything. I miss the Korean mountains..........:(
Updated on December 24, 2022Comments
-
Zach Smith over 1 year
I'm using the following Actions YAML to try to build an Android APK from a Flutter app:
name: CI on: push: branches: - master pull_request: branches: - master jobs: build-and-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 # we need java to build android apks - uses: actions/setup-java@v1 with: java-version: '12.x' # this flutter action does the heavy lifting for us - uses: subosito/flutter-action@v1 with: channel: 'stable' # get packages as you used to in your computer - run: flutter pub get # Now build apk - run: flutter build apk --split-per-abi # now relase the just created build - name: Create a Release APK uses: ncipollo/release-action@v1 with: artifacts: "build/app/outputs/apk/release/*.apk" token: ${{ secrets.TOKEN }}
When this is ran, it fails, returning:
0s Run ncipollo/release-action@v1 with: artifacts: build/app/outputs/apk/release/*.apk token: *** omitBody: false omitBodyDuringUpdate: false omitName: false omitNameDuringUpdate: false replacesArtifacts: true env: JAVA_HOME_12.0.2_x64: /opt/hostedtoolcache/jdk/12.0.2/x64 JAVA_HOME: /opt/hostedtoolcache/jdk/12.0.2/x64 JAVA_HOME_12_0_2_X64: /opt/hostedtoolcache/jdk/12.0.2/x64 FLUTTER_HOME: /opt/hostedtoolcache/flutter/1.22.0-stable/x64 Error: Error undefined: No tag found in ref or input!
At the 'Create and Release APK' stage of the action. I'm trying to figure this out. What is my YAML missing, or is this a one-off scenario?
-
Zach Smith over 3 yearsThanks for the clarification. I notice if I set
tag:"latest"
the action works. But if I remove that line, and my pull request to master includes a tag, the action fails. -
riQQ over 3 yearsIn a pull request the
ref
will be something likerefs/pull/1/merge
, because the workflow runs against the merged result against the branch you're pulling from (see stackoverflow.com/questions/63323498/…). So the release action won't see the tag on the branch you're pulling from. -
Zach Smith over 3 yearsCould you help explain how to change this yml file to always run when a push to
master
is updated and I don't have to manually change thetag
in this workflow file each time? -
riQQ over 3 yearsDo you really want to create a GitHub release for pull requests? Or only if you push tags to master?
-
Zach Smith over 3 yearsI would prefer to have a new release/APKs built each time a pull request is merged into master. If that is too difficult: any time a push to master. I really appreciate your help.