-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (44 loc) · 1.37 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
name: Create release
on:
push:
tags:
- v*
permissions:
contents: write
jobs:
release:
name: Release pushed tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changelog from CHANGELOG.md
run: |
tag="${GITHUB_REF#refs/tags/}"
echo "Tag: $tag"
changelog=$(awk "/^## \[$tag\]/{flag=1;next}/^## /{flag=0}flag" CHANGELOG.md)
echo "$changelog" > NOTES.md
cat NOTES.md
- name: Create release
if: ${{ !env.ACT }} # do not run locally
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
-F NOTES.md
- name: Get Main version
id: vars
run: |
main_version=$(echo ${{ github.ref_name }} | cut -d '.' -f 1)
echo "Main version: $main_version"
echo "main_version=$main_version" >> "$GITHUB_OUTPUT"
- name: Update Main version
if: ${{ !env.ACT }} # do not run locally
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag -f ${{ steps.vars.outputs.main_version }} ${{ github.ref_name }}
git push origin ${{ steps.vars.outputs.main_version }} --force