Skip to content

Commit 149255b

Browse files
committed
Add release action
1 parent 51a6b60 commit 149255b

File tree

3 files changed

+74
-15
lines changed

3 files changed

+74
-15
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
#
33
# After building, artifacts are released to a seperate repository.
44

5-
env:
6-
debugBuild: true
7-
85
name: CI
96

10-
on: workflow_call
7+
on:
8+
workflow_call:
9+
inputs:
10+
debug_build:
11+
description: 'Specifies if it is a debug build or a release build'
12+
default: true
13+
required: false
14+
type: boolean
1115

1216
jobs:
1317
test:
@@ -74,14 +78,14 @@ jobs:
7478
- run: yarn install --immutable --immutable-cache --check-cache
7579

7680
- run: yarn gulp release ${{ matrix.releaseArgs }}
77-
if: ${{ !env.debugBuild }}
81+
if: ${{ !inputs.debug_build && matrix.name != 'Android' }}
7882

7983
- run: yarn gulp debug-release ${{ matrix.releaseArgs }}
80-
if: ${{ env.debugBuild }}
84+
if: ${{ inputs.debug_build || matrix.name == 'Android' }}
8185

8286
- name: Publish build artifacts
8387
uses: actions/upload-artifact@v2
8488
with:
85-
name: Betaflight-Configurator${{ env.debugBuild == 'true' && '-Debug' || '' }}-${{ matrix.name }}
89+
name: Betaflight-Configurator${{ inputs.debug_build == 'true' && '-Debug' || '' }}-${{ matrix.name }}
8690
path: release/
8791
retention-days: 90

.github/workflows/nightly.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# You'll need to setup the follwing environment variables:
2-
# env.repoNightly - The repository to release nightly builds to e.g. betaflight-configurator-nightly
3-
# env.releaseNotes - The release notes to be published as part of the github release
2+
# env.repo_nightly - The repository to release nightly builds to e.g. betaflight-configurator-nightly
3+
# env.release_notes - The release notes to be published as part of the github release
4+
# env.debug_release_notes - The release notes to be published as part of the github debug release
45
# secrets.REPO_TOKEN - A GitHub token with permissions to push and publish releases to the nightly repo
56

67
env:
7-
repoNightly: betaflight/betaflight-configurator-nightlies
8-
debugReleaseNotes: >
8+
repo_nightly: betaflight/betaflight-configurator-nightlies
9+
debug_release_notes: >
910
This is an automated development build.
1011
It may be unstable and result in corrupted configurations or data loss.
1112
**Use only for testing.**
12-
releaseNotes: This is a release build. It does not contain the debug console.
13+
release_notes: This is a release build. It does not contain the debug console.
1314

1415
name: Nightly
1516

@@ -23,9 +24,11 @@ jobs:
2324
ci:
2425
name: CI
2526
uses: ./.github/workflows/ci.yml
27+
with:
28+
debug_build: true
2629

2730
release:
28-
name: Release
31+
name: Nightly release
2932
needs: ci
3033
runs-on: ubuntu-20.04
3134
steps:
@@ -38,7 +41,8 @@ jobs:
3841
id: notes
3942
run: |
4043
set -- release-assets/Betaflight-Configurator-Debug-*
41-
echo "::set-output name=notes::$(test -e "$1" && echo '${{ env.debugReleaseNotes }}' || echo '${{ env.releaseNotes }}')"
44+
echo "::set-output name=notes::$(test -e "$1" && echo '${{ env.debug_release_notes }}' || echo '${{ env.release_n
45+
otes }}')"
4246

4347
- name: Get current date
4448
id: date
@@ -48,7 +52,7 @@ jobs:
4852
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14
4953
with:
5054
token: ${{ secrets.REPO_TOKEN }}
51-
repository: ${{ env.repoNightly }}
55+
repository: ${{ env.repo_nightly }}
5256
tag_name: v${{ steps.date.outputs.today }}.${{ github.run_number }}
5357
files: release-assets/Betaflight-Configurator-*/**
5458
draft: false

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# You'll need to setup the follwing environment variables:
2+
# secrets.REPO_TOKEN - A GitHub token with permissions to push and publish releases to the repo
3+
4+
name: Release
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
title:
10+
description: 'Title to assign to the release'
11+
required: true
12+
type: string
13+
14+
tag:
15+
description: 'Tag to assign to the release source code'
16+
required: true
17+
type: string
18+
19+
generate_release_notes:
20+
description: 'Generate release notes?'
21+
required: true
22+
type: boolean
23+
24+
jobs:
25+
ci:
26+
name: CI
27+
uses: ./.github/workflows/ci.yml
28+
with:
29+
debug_build: false
30+
31+
release:
32+
name: Release
33+
needs: ci
34+
runs-on: ubuntu-20.04
35+
steps:
36+
- name: Fetch build artifacts
37+
uses: actions/download-artifact@v2
38+
with:
39+
path: release-assets/
40+
41+
- name: Release
42+
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14
43+
with:
44+
token: ${{ secrets.GITHUB_TOKEN }}
45+
name: ${{ github.event.inputs.title }}
46+
tag_name: ${{ github.event.inputs.tag }}
47+
generate_release_notes: ${{ github.event.inputs.generate_release_notes }}
48+
files: release-assets/Betaflight-Configurator-*/**
49+
draft: true
50+
prerelease: false
51+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)