-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 1.89 KB
/
release.yaml
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
name: "Release"
on:
workflow_dispatch:
jobs:
action:
name: "Release GitHub Action"
runs-on: "ubuntu-22.04"
permissions:
contents: "write"
steps:
- name: "Check out repository"
id: "checkout"
uses: "actions/checkout@v4"
- name: "Configure Git"
id: "config"
run: |
git config 'user.name' 'github-actions[bot]'
git config 'user.email' '41898282+github-actions[bot]@users.noreply.github.com'
- name: "Batch changes"
id: "batch"
uses: "miniscruff/changie-action@v2"
with:
args: "batch auto"
- name: "Merge changes"
id: "merge"
uses: "miniscruff/changie-action@v2"
with:
args: "merge"
- name: "Get version"
id: "version"
uses: "miniscruff/changie-action@v2"
with:
args: "latest --remove-prefix"
- name: "Commit changes"
id: "commit"
run: |
version='${{ steps.version.outputs.output }}'
changes="$(tail --lines +3 ".changes/v$version.md" | sed 's/^##//')"
echo -e "changes<<EOF\n$changes\nEOF" >> "$GITHUB_OUTPUT"
git add .
git commit --message "chore: release version $version"
git push
for tag in "v$version" "v$(echo "$version" | cut --delimiter '.' --field '1')" 'latest'
do
git tag --annotate --message "version $version" --message "$changes" --cleanup verbatim --force "$tag"
done
git push --tags --force
- name: "Publish release"
id: "publish"
run: |
version='${{ steps.version.outputs.output }}'
changes='${{ steps.commit.outputs.changes }}'
changes="$(echo "$changes" | sed 's/^#/##/')"
gh release create --title "Version $version" --notes "$changes" "v$version"
env:
GH_TOKEN: "${{ github.token }}"