-
Notifications
You must be signed in to change notification settings - Fork 6
72 lines (68 loc) · 2.49 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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);
}