-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 1.75 KB
/
Copy pathrelease.yml
File metadata and controls
62 lines (54 loc) · 1.75 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
name: Create release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
pull-requests: write
jobs:
build:
name: "Release"
runs-on: ubuntu-latest
steps:
- name: "Check-out"
uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Get previous semver tag
id: prev_tag
run: |
CURRENT_TAG="${{ github.ref_name }}"
PREVIOUS_TAG=$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | grep -B1 "^${CURRENT_TAG}$" | head -n1)
if [ "$PREVIOUS_TAG" = "$CURRENT_TAG" ]; then
PREVIOUS_TAG=""
fi
echo "tag=${PREVIOUS_TAG}" >> "$GITHUB_OUTPUT"
- name: Generate changelog with git-cliff
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
env:
OUTPUT: RELEASE.md
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Append full changelog link
if: steps.prev_tag.outputs.tag != ''
run: |
echo "" >> RELEASE.md
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.prev_tag.outputs.tag }}...${{ github.ref_name }}" >> RELEASE.md
- name: "Create GitHub release"
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body_path: RELEASE.md
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Update major version tag"
uses: somaz94/major-tag-action@v1
with:
tag: ${{ github.ref_name }}
github_token: ${{ secrets.PAT_TOKEN }}