Skip to content

Commit e328ac5

Browse files
committed
update action
1 parent d5f3b43 commit e328ac5

File tree

1 file changed

+25
-41
lines changed

1 file changed

+25
-41
lines changed

.github/workflows/release.yaml

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,30 @@
1-
name: "Create a release"
1+
name: Create Release
22

3-
description: "Creates a release"
3+
on:
4+
workflow_dispatch
45

5-
inputs:
6-
github-token:
7-
description: "GitHub token of a user with permission to create a release"
8-
required: true
6+
jobs:
7+
create_release:
8+
runs-on: ubuntu-latest
99

10-
runs:
11-
using: "composite"
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2
1213

13-
steps:
14-
- name: "Determine tag"
15-
if: "${{ github.event_name }} == 'push' && ${{ github.ref_type }} == 'tag'"
16-
run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"
17-
shell: "bash"
18-
19-
- name: "Create release"
20-
uses: "actions/github-script@v7.0.1"
14+
- name: Create Release
15+
id: create_release
16+
uses: actions/create-release@v1
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2119
with:
22-
github-token: "${{ inputs.github-token }}"
23-
script: |
24-
if (!process.env.RELEASE_TAG) {
25-
core.setFailed("The environment variable RELEASE_TAG is not defined.")
26-
27-
return;
28-
}
29-
30-
try {
31-
const response = await github.rest.repos.createRelease({
32-
draft: false,
33-
generate_release_notes: true,
34-
name: process.env.RELEASE_TAG,
35-
owner: context.repo.owner,
36-
prerelease: false,
37-
repo: context.repo.repo,
38-
tag_name: process.env.RELEASE_TAG,
39-
});
40-
41-
core.exportVariable('RELEASE_HTML_URL', response.data.html_url);
42-
core.exportVariable('RELEASE_ID', response.data.id);
43-
core.exportVariable('RELEASE_UPLOAD_URL', response.data.upload_url);
44-
} catch (error) {
45-
core.setFailed(error.message);
46-
}
20+
tag_name: ${{ github.ref_name }}
21+
release_name: ${{ github.ref_name }}
22+
draft: false
23+
prerelease: false
24+
generate_release_notes: true
25+
26+
- name: Set outputs for the created release
27+
run: |
28+
echo "::set-output name=release_id::${{ steps.create_release.outputs.id }}"
29+
echo "::set-output name=html_url::${{ steps.create_release.outputs.html_url }}"
30+
echo "::set-output name=upload_url::${{ steps.create_release.outputs.upload_url }}"

0 commit comments

Comments
 (0)