Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Actions: Multiple jobs single release

I am having 2 jobs in the Github runner. The first job builds the android apk. The second one to build a zip file. I want to have both the apk and the zip file in the same release. But after the apk is published into a release, the zip file does not get published into the release. The error shown is:
Validation Failed {"resource":"Release","code":"already_exists","field":"tag_name"}
buid.yml:

name: Build Process

on:
 push:
  tags:
   - v*

jobs:
 Build_Android:
if: "!contains(github.event.head_commit.message, 'skip-android')"
name: Build APK
runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v2
  - name: Setup Java
    uses: actions/setup-java@v2
    with:
      distribution: "zulu"
      java-version: "12.x"

  - name: Setup Flutter
    uses: subosito/flutter-action@v1
    with:
      channel: "stable"

  - name: Get Packages
    run: flutter pub get

  - name: Build APK
    run: flutter build apk --split-per-abi --release

  - name: Create Github Release
    uses: ncipollo/release-action@v1
    with:
      artifacts: "build/app/outputs/flutter-apk/*.apk"
      replacesArtifacts: false
      token: ${{ secrets.TOKEN }}

Build_Windows:
if: "!contains(github.event.head_commit.message, 'skip-windows')"
name: Building zip
runs-on: windows-latest

steps:
  - uses: actions/checkout@v2
  - name: Setup Java
    uses: actions/setup-java@v2
    with:
      distribution: "zulu"
      java-version: "12.x"

  - name: Setup Flutter
    uses: subosito/flutter-action@v1
    with:
      channel: "stable"

  - name: Get Packages
    run: flutter pub get

  - name: Enable windows build
    run: flutter config --enable-windows-desktop

  - name: Build Artifacts
    run: flutter build windows --release

  - name: Archive Artifacts
    uses: thedoctor0/zip-release@master
    with:
      type: "zip"
      filename: AppName-${{github.ref_name}}-windows.zip
      directory: build/windows/runner/Release

  - name: Create Github Release
    uses: ncipollo/release-action@v1
    with:
      artifacts: "build/windows/runner/Release/AppName-${{github.ref_name}}-windows.zip"
      replacesArtifacts: false
      token: ${{ secrets.TOKEN }}

Any help is greatly appreciated!
Thank!

like image 667
Ajit Kumar Avatar asked Nov 28 '25 13:11

Ajit Kumar


1 Answers

The error says that:

Release with this tag name already exists

It is coming from your last step:

ncipollo/release-action@v1

By default this action seems to be always trying to create a new release ("This action will create a GitHub release"), but according to its documentation here you can alter that behaviour by adding:

allowUpdates = "true"

- name: Create Github Release
  uses: ncipollo/release-action@v1
  with:
    artifacts: "build/windows/runner/Release/AppName-${{github.ref_name}}-windows.zip"
    replacesArtifacts: false
    token: ${{ secrets.TOKEN }}
    allowUpdates: true
like image 66
Grzegorz Krukowski Avatar answered Dec 02 '25 05:12

Grzegorz Krukowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!