@@ -58,6 +58,16 @@ inputs:
5858 current working directory.
5959 default : " ."
6060
61+ action-gh-release-parameters :
62+ description : |
63+ A JSON string containing parameters to pass to `softprops/action-gh-release@v2`. You can use
64+ the `toJSON()` function in your action to make passing this easier.
65+ default : " {}"
66+
67+ _force-release-for-testing :
68+ description : |
69+ This exists to let me test the release parts of this action.
70+
6171outputs :
6272 artifact-id :
6373 description : |
93103 INPUTS_extra-files : ${{ inputs.extra-files }}
94104 INPUTS_changes_file : ${{ inputs.changes-file }}
95105 INPUTS_working_directory : ${{ inputs.working-directory }}
106+ INPUTS_action_gh_release_parameters : ${{ inputs.action-gh-release-parameters }}
96107
97108 - name : Package as archive
98109 id : package-archive
@@ -114,8 +125,8 @@ runs:
114125
115126 cd ${{ inputs.working-directory }}
116127 shasum --algorithm 256 \
117- "${{ steps.package-archive.outputs.archive-basename }}" \
118- > "${{ steps.package-archive.outputs.archive-basename }}.sha256"
128+ "${{ steps.package-archive.outputs.archive-file }}" \
129+ > "${{ steps.package-archive.outputs.archive-file }}.sha256"
119130 if : runner.os != 'Windows'
120131
121132 - name : Install dos2unix and psutils on Windows
@@ -129,23 +140,44 @@ runs:
129140 run : |
130141 cd ${{ inputs.working-directory }}
131142 shasum --algorithm 256 `
132- "${{ steps.package-archive.outputs.archive-basename }}" `
133- > "${{ steps.package-archive.outputs.archive-basename }}.sha256"
134- dos2unix "${{ steps.package-archive.outputs.archive-basename }}.sha256"
143+ "${{ steps.package-archive.outputs.archive-file }}" `
144+ > "${{ steps.package-archive.outputs.archive-file }}.sha256"
145+ dos2unix "${{ steps.package-archive.outputs.archive-file }}.sha256"
135146 if : runner.os == 'Windows'
136147
137148 - name : Publish release artifact for run
138149 id : publish-release-artifact
139150 uses : actions/upload-artifact@v4
140151 with :
141- name : ${{ steps.package-archive.outputs.archive-basename }}
142- path : ${{ inputs.working-directory }}/${{ steps.package-archive.outputs.archive-basename }}*
152+ name : ${{ steps.package-archive.outputs.archive-file }}
153+ path : ${{ inputs.working-directory }}/${{ steps.package-archive.outputs.archive-file }}*
154+
155+ - name : Parse `action-gh-release-parameters` and set inputs for `softprops/action-gh-release`
156+ id : action-gh-release-parameters
157+ shell : bash
158+ run : |
159+ set -e
160+ set -x
161+ set -o pipefail
162+
163+ FAKE_TAG=""
164+ if [ -n "${{ inputs._force-release-for-testing }}" ]; then
165+ workflow_path=${${{ github.workflow_ref }}%%@*}
166+ workflow_file=basename "$workflow_path"
167+ FAKE_TAG="v-${{ github.ref_name }}-${{ github.sha }}-${{ github.run_number }}-$workflow_file"
168+ fi
169+ # This will get the inputs JSON from the `ACTION_GH_RELEASE_PARAMETERS` env var. This avoids
170+ # any string interpolation issues, since the inputs will contain quotes.
171+ parse-and-set-action-gh-release-parameters.py \
172+ --working-directory "${{ inputs.working-directory }}" \
173+ --archive-file "${{ steps.package-archive.outputs.archive-file }}" \
174+ --changes-file "${{ inputs.changes-file }}" \
175+ --fake-tag "$FAKE_TAG"
176+ env :
177+ ACTION_GH_RELEASE_PARAMETERS : ${{ inputs.action-gh-release-parameters }}
178+ if : ( github.ref_type == 'tag' && startsWith( github.ref_name, inputs.release-tag-prefix ) ) || inputs._force-release-for-testing
143179
144180 - name : Publish GitHub release
145181 uses : softprops/action-gh-release@v2
146- with :
147- draft : true
148- # The trailing "*" should pick up the checksum file.
149- files : ${{ inputs.working-directory }}/${{ steps.package-archive.outputs.archive-basename }}*
150- body_path : ${{ ( inputs.changes-file && format( '{0}/{1}', inputs.working-directory, inputs.changes-file ) ) || '' }}
151- if : github.ref_type == 'tag' && startsWith( github.ref_name, inputs.release-tag-prefix )
182+ with : ${{ steps.action-gh-release-parameters.outputs }}
183+ if : ( github.ref_type == 'tag' && startsWith( github.ref_name, inputs.release-tag-prefix ) ) || inputs._force-release-for-testing
0 commit comments