1010 envs :
1111 required : false
1212 type : string
13- push :
14- required : false
15- type : boolean
1613 release :
1714 required : false
18- type : boolean
15+ type : string
1916
2017env :
2118 REPO_SLUG : dockereng/packaging
3734 uses : actions/github-script@v7
3835 env :
3936 INPUT_NAME : ${{ inputs.name }}
37+ INPUT_RELEASE : ${{ inputs.release }}
4038 with :
4139 script : |
4240 const inpName = core.getInput('name');
41+ const inpRelease = core.getInput('release');
42+
43+ if (inpRelease !== '' && !['pushonly', 'draft', 'prerelease', 'release'].includes(inpRelease)) {
44+ throw new Error(`Invalid release type: ${inpRelease}`);
45+ }
4346
4447 let def = {};
4548 await core.group(`Parsing definition`, async () => {
@@ -105,8 +108,8 @@ jobs:
105108 done
106109 -
107110 name : Prepare
111+ # Set platform pair for artifact upload
108112 run : |
109- # Set platform pair for artifact upload
110113 platform=${{ matrix.platform }}
111114 echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
112115 -
@@ -219,7 +222,7 @@ jobs:
219222 -
220223 name : Login to Docker Hub
221224 uses : docker/login-action@v3
222- if : ${{ inputs.push || inputs. release || github.event_name == 'schedule' }}
225+ if : ${{ inputs.release || github.event_name == 'schedule' }}
223226 with :
224227 username : ${{ secrets.DOCKERPUBLICBOT_USERNAME }}
225228 password : ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }}
@@ -235,7 +238,7 @@ jobs:
235238 targets : release-${{ inputs.name }}
236239 provenance : false
237240 set : |
238- *.output=type=image,push=${{ inputs.push || inputs. release || github.event_name == 'schedule' }}
241+ *.output=type=image,push=${{ inputs.release || github.event_name == 'schedule' }}
239242 *.output=/tmp/release
240243 -
241244 name : List release artifacts
@@ -296,10 +299,11 @@ jobs:
296299 -
297300 name : Create release
298301 uses : softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
299- if : ${{ inputs.release }}
302+ if : ${{ inputs.release && inputs.release != 'pushonly' }}
300303 with :
301304 name : ${{ env.GIT_TAG }}-${{ github.run_number }}
302- draft : true
305+ draft : ${{ inputs.release == 'draft' }}
306+ prerelease : ${{ inputs.release == 'prerelease' }}
303307 tag_name : ${{ env.GIT_TAG }}-${{ github.run_number }}
304308 target_commitish : ${{ github.sha }}
305309 files : |
0 commit comments