diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b191f3c5..687f03eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,12 +2,16 @@ # # After building, artifacts are released to a seperate repository. -env: - debugBuild: true - 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: test: @@ -74,14 +78,14 @@ jobs: - run: yarn install --immutable --immutable-cache --check-cache - run: yarn gulp release ${{ matrix.releaseArgs }} - if: ${{ !env.debugBuild }} + if: ${{ !inputs.debug_build && matrix.name != 'Android' }} - run: yarn gulp debug-release ${{ matrix.releaseArgs }} - if: ${{ env.debugBuild }} + if: ${{ inputs.debug_build || matrix.name == 'Android' }} - name: Publish build artifacts uses: actions/upload-artifact@v2 with: - name: Betaflight-Configurator${{ env.debugBuild == 'true' && '-Debug' || '' }}-${{ matrix.name }} + name: Betaflight-Configurator${{ inputs.debug_build == 'true' && '-Debug' || '' }}-${{ matrix.name }} path: release/ retention-days: 90 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 649252ee..41f7e383 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,15 +1,16 @@ # You'll need to setup the follwing environment variables: -# env.repoNightly - The repository to release nightly builds to e.g. betaflight-configurator-nightly -# env.releaseNotes - The release notes to be published as part of the github release +# env.repo_nightly - The repository to release nightly builds to e.g. betaflight-configurator-nightly +# env.release_notes - The release notes to be published as part of the github release +# env.debug_release_notes - The release notes to be published as part of the github debug release # secrets.REPO_TOKEN - A GitHub token with permissions to push and publish releases to the nightly repo env: - repoNightly: betaflight/betaflight-configurator-nightlies - debugReleaseNotes: > + repo_nightly: betaflight/betaflight-configurator-nightlies + debug_release_notes: > This is an automated development build. It may be unstable and result in corrupted configurations or data loss. **Use only for testing.** - releaseNotes: This is a release build. It does not contain the debug console. + release_notes: This is a release build. It does not contain the debug console. name: Nightly @@ -23,9 +24,11 @@ jobs: ci: name: CI uses: ./.github/workflows/ci.yml + with: + debug_build: true release: - name: Release + name: Nightly release needs: ci runs-on: ubuntu-20.04 steps: @@ -38,7 +41,8 @@ jobs: id: notes run: | set -- release-assets/Betaflight-Configurator-Debug-* - echo "::set-output name=notes::$(test -e "$1" && echo '${{ env.debugReleaseNotes }}' || echo '${{ env.releaseNotes }}')" + echo "::set-output name=notes::$(test -e "$1" && echo '${{ env.debug_release_notes }}' || echo '${{ env.release_n + otes }}')" - name: Get current date id: date @@ -48,7 +52,7 @@ jobs: uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14 with: token: ${{ secrets.REPO_TOKEN }} - repository: ${{ env.repoNightly }} + repository: ${{ env.repo_nightly }} tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }} files: release-assets/Betaflight-Configurator-*/** draft: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..cc5b9c80 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +# You'll need to setup the follwing environment variables: +# secrets.REPO_TOKEN - A GitHub token with permissions to push and publish releases to the repo + +name: Release + +on: + workflow_dispatch: + inputs: + title: + description: 'Title to assign to the release' + required: true + type: string + + tag: + description: 'Tag to assign to the release source code' + required: true + type: string + + generate_release_notes: + description: 'Generate release notes?' + required: true + type: boolean + +jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml + with: + debug_build: false + + release: + name: Release + needs: ci + runs-on: ubuntu-20.04 + steps: + - name: Fetch build artifacts + uses: actions/download-artifact@v2 + with: + path: release-assets/ + + - name: Release + uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14 + with: + token: ${{ secrets.GITHUB_TOKEN }} + name: ${{ github.event.inputs.title }} + tag_name: ${{ github.event.inputs.tag }} + generate_release_notes: ${{ github.event.inputs.generate_release_notes }} + files: release-assets/Betaflight-Configurator-*/** + draft: true + prerelease: false + fail_on_unmatched_files: true