-
Notifications
You must be signed in to change notification settings - Fork 19
63 lines (55 loc) · 1.74 KB
/
Copy pathrelease.yml
File metadata and controls
63 lines (55 loc) · 1.74 KB
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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Semver version (no leading v)"
required: true
type: string
prerelease:
description: "Mark as prerelease"
required: false
type: boolean
default: false
permissions:
contents: write
jobs:
release:
name: Tag and publish GitHub release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Validate version
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "Version '${{ inputs.version }}' is not valid semver"; exit 1
fi
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Tag
run: |
git tag -a "v${{ inputs.version }}" -m "Release v${{ inputs.version }}"
git push origin "v${{ inputs.version }}"
- name: Generate release notes
id: notes
uses: actions/github-script@v9
with:
script: |
const { data } = await github.rest.repos.generateReleaseNotes({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: `v${{ inputs.version }}`,
});
core.setOutput('body', data.body);
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ inputs.version }}
name: v${{ inputs.version }}
body: ${{ steps.notes.outputs.body }}
prerelease: ${{ inputs.prerelease }}
draft: false