From 345d03bc051cde6fe667e87af2edb0dcc1e5ce21 Mon Sep 17 00:00:00 2001 From: Lennard Jouvenal Date: Mon, 5 Sep 2022 17:26:14 +0200 Subject: [PATCH] Build and add APKs to github release (#96) * Make Flutter Build workflow reusable * provide artifact name via input variable (with default value) * Automatically add build artifacts to github release * workaround for https://github.com/actions/runner/issues/480 --- .github/workflows/flutter_build.yml | 11 ++++++++++- .github/workflows/github_release.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/github_release.yml diff --git a/.github/workflows/flutter_build.yml b/.github/workflows/flutter_build.yml index f4c4eb9..fb46a63 100644 --- a/.github/workflows/flutter_build.yml +++ b/.github/workflows/flutter_build.yml @@ -13,6 +13,14 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + # Allows this workflow to be called from other workflows + workflow_call: + inputs: + artifactName: + description: "Name of the uploaded artifact" + required: true + type: string + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" @@ -25,6 +33,7 @@ jobs: KEY_PATH: /home/runner/key.jks KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} KEY_ALIAS: key + ARTIFACT_NAME: ${{ inputs.artifactName || 'release-apk' }} steps: - uses: actions/checkout@v2 @@ -44,6 +53,6 @@ jobs: - name: Archive artifacts uses: actions/upload-artifact@v2 with: - name: release-apk + name: ${{ env.ARTIFACT_NAME }} path: | build/app/outputs/apk/* diff --git a/.github/workflows/github_release.yml b/.github/workflows/github_release.yml new file mode 100644 index 0000000..2098858 --- /dev/null +++ b/.github/workflows/github_release.yml @@ -0,0 +1,27 @@ +name: Github Release + +on: + release: + types: [published] + +jobs: + build: + uses: ./.github/workflows/flutter_build.yml + secrets: inherit + with: + artifactName: 'release' + + add-artifacts-to-release: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: 'release' + + - name: Add artifacts to release + uses: softprops/action-gh-release@v1 + with: + files: 'release/*.apk'