File tree Expand file tree Collapse file tree 4 files changed +20
-3
lines changed
Expand file tree Collapse file tree 4 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 11module . exports = async ( { github, context, core } ) => {
2+ const knownEvents = [ "schedule" , "workflow_dispatch" , "release" ] ;
3+ if ( ! knownEvents . includes ( context . eventName ) ) {
4+ core . setFailed ( `Triggerd by unknown event: ${ context . eventName } ` ) ;
5+ return ;
6+ }
7+
28 const { STABLE , TAG } = process . env ;
9+
10+ // trigger by release event
311 if ( context . ref . startsWith ( "refs/tags/" ) ) {
412 let tag = context . ref . replace ( "refs/tags/" , "" ) ;
513 core . setOutput ( "tag" , tag ) ;
14+ core . setOutput ( "sha" , context . sha ) ;
615 core . info ( `Tag event triggered by ${ tag } .` ) ;
716 return ;
817 }
18+
19+ // trigger by schedule or workflow_dispatch event
920 if ( STABLE == "true" ) {
1021 if ( TAG ) {
1122 // trigger stable release by workflow_dispatch with a tag
Original file line number Diff line number Diff line change 88 - reopened
99 branches :
1010 - main
11+ - backport/*
1112
1213concurrency :
1314 group : ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
Original file line number Diff line number Diff line change 44 push :
55 branches :
66 - main
7+ - backport/*
78
89jobs :
910 changes :
Original file line number Diff line number Diff line change 1313 description : Make a stable release
1414 required : false
1515 type : boolean
16+ release :
17+ types :
18+ - published
1619
1720permissions :
1821 id-token : write
@@ -47,19 +50,20 @@ jobs:
4750 const script = require('./.github/scripts/bump_version.js')
4851 await script({ github, context, core })
4952 - name : Create release
53+ if : github.event_name == 'workflow_dispatch'
5054 env :
5155 # we need workflow:write permission to create release if there were any workflow changes
5256 # which is not possible for github actions token
5357 GH_TOKEN : ${{ secrets.DATABEND_BOT_TOKEN }}
5458 run : |
5559 echo "Creating release ${{ steps.bump.outputs.tag }} from ${{ steps.bump.outputs.sha }}"
5660 if [[ "${{ inputs.stable }}" == "true" ]]; then
57- echo "Stable release"
5861 previous=$(gh release list --limit 1 --exclude-pre-releases | cut -f 1)
62+ echo "Stable release with previous release: $previous"
5963 gh release create ${{ steps.bump.outputs.tag }} --target ${{ steps.bump.outputs.sha }} --generate-notes --notes-start-tag $previous --latest --draft
6064 else
61- echo "Nightly release"
62- previous=$(gh release list --limit 1 | cut -f 1)
65+ previous=$(gh release list --limit 10 | grep nightly | head -n 1 | cut -f 1)
66+ echo "Nightly release with previous release: $previous"
6367 gh release create ${{ steps.bump.outputs.tag }} --target ${{ steps.bump.outputs.sha }} --generate-notes --notes-start-tag $previous --prerelease --draft
6468 fi
6569
You can’t perform that action at this time.
0 commit comments