Manual release #234
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manual release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
required: true | |
description: What version to be released? | |
default: "v0.0.0" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release-job: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v7 | |
id: get-release-note | |
with: | |
result-encoding: string | |
script: | | |
const release = await github.rest.repos.getReleaseByTag({ | |
owner: 'k1low', | |
repo: 'runn', | |
tag: '${{ github.event.inputs.version }}', | |
}) | |
console.log(release) | |
core.setOutput('url', release.data.html_url); | |
return release.data.body | |
- uses: actions/checkout@v4 | |
- name: Bump up image version | |
id: bump-up-image-version | |
run: | | |
sed -i -e "s/default: \"v[.0-9]\{1,\}\"/default: \"${{ github.event.inputs.version }}\"/g" action.yml | |
git diff | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
committer_name: GitHub Actions | |
committer_email: 41898282+github-actions[bot]@users.noreply.github.com | |
message: 'refs ${{ steps.get-release-note.outputs.url }}, Bump up image version' | |
add: 'action.yml' | |
new_branch: 'release/${{ github.event.inputs.version }}' | |
tag: '${{ github.event.inputs.version }} --force' | |
tag_push: '--force' | |
- name: Create Release | |
uses: actions/github-script@v7 | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
try { | |
const release_note = function() {/* | |
${{ steps.get-release-note.outputs.result }} | |
*/}.toString().split('/*')[1].split('*/')[0]; | |
const response = await github.rest.repos.createRelease({ | |
draft: false, | |
generate_release_notes: true, | |
name: 'Release ${{ github.event.inputs.version }}', | |
owner: context.repo.owner, | |
prerelease: false, | |
repo: context.repo.repo, | |
tag_name: '${{ github.event.inputs.version }}', | |
body: release_note | |
}); | |
core.exportVariable('RELEASE_ID', response.data.id); | |
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url); | |
} catch (error) { | |
core.setFailed(error.message); | |
} |