From 7d173fc7243b291f120495860e5f1afc23563f54 Mon Sep 17 00:00:00 2001 From: blckmn Date: Tue, 14 Jun 2022 10:57:45 +1000 Subject: [PATCH] Automated release build process as per configurator --- .github/workflows/build-release.yml | 41 +++++++++++++++++++++++++++++ .github/workflows/ci.yml | 20 ++++++++------ 2 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 00000000..9ac12115 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,41 @@ +## This is triggered by the publishing of a release, and will build the assets and attach them. + +name: On Release + +on: + release: + types: [published] + +jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml + with: + debug_build: false + + release: + name: Attach Release Artifacts + needs: ci + runs-on: ubuntu-22.04 + steps: + - name: Code Checkout + uses: actions/checkout@v2 + + - name: Fetch build artifacts + uses: actions/download-artifact@v2 + + - name: List assets + run: ls -al Betaflight-*/* + + - name: Attach assets to release + run: | + set -x + assets=() + for asset in Betaflight-*/*; do + assets+=("-a" "$asset") + echo "$asset" + done + tag_name="${GITHUB_REF##*/}" + hub release edit "${assets[@]}" -m "" "$tag_name" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bd279b0..400ecb38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,17 @@ # Builds Betaflight Blackbox Explorer on Windows, Linux and macOS platforms. # -# After building, artifacts are released to a separate repository. - -env: - debugBuild: true +# After building, artifacts are released to a seperate repository. name: CI -on: workflow_call +on: + workflow_call: + inputs: + debug_build: + description: 'Specifies if it is a debug build or a release build' + default: true + required: false + type: boolean jobs: build: @@ -45,14 +49,14 @@ jobs: - run: yarn install --immutable --immutable-cache --check-cache - run: yarn gulp release ${{ matrix.releaseArgs }} - if: ${{ !env.debugBuild }} + if: ${{ !inputs.debug_build }} - run: yarn gulp debug-release ${{ matrix.releaseArgs }} - if: ${{ env.debugBuild }} + if: ${{ inputs.debug_build }} - name: Publish build artifacts uses: actions/upload-artifact@v2 with: - name: Betaflight-Blackbox-Explorer${{ env.debugBuild == 'true' && '-Debug' || '' }}-${{ matrix.name }} + name: Betaflight-Blackbox-Explorer${{ inputs.debug_build == 'true' && '-Debug' || '' }}-${{ matrix.name }} path: release/ retention-days: 90