-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (63 loc) · 2.07 KB
/
on-tag.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Tag
on:
push:
tags:
- "v*"
pull_request:
types: [closed]
branches:
- main
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
version:
runs-on: ubuntu-latest
if: ${{ (startsWith(github.head_ref, 'release/v') && github.event.pull_request.merged) || startsWith(github.ref, 'refs/tags/v') }}
outputs:
version: ${{ env.VERSION }}
steps:
- id: is-release-merged
if: ${{ startsWith(github.head_ref, 'release/v') && github.event.pull_request.merged }}
run: |
VERSION=${GITHUB_HEAD_REF##*/}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: tag-release
if: ${{ startsWith(github.head_ref, 'release/v') && github.event.pull_request.merged }}
uses: mathieudutour/[email protected]
with:
create_annotated_tag: true
custom_tag: ${{ env.VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: ""
- id: is-tag
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
build-release:
name: Release
runs-on: ubuntu-latest
needs: version
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create changelog
id: changelog
if: ${{ !contains(needs.version.outputs.version, '-') }}
uses: mikepenz/[email protected]
with:
ignorePreReleases: true
configuration: .github/changelog.json
toTag: ${{ needs.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release
uses: softprops/[email protected]
with:
files: releases/*
body: ${{ steps.changelog.outputs.changelog }}
tag_name: ${{ needs.version.outputs.version }}
prerelease: ${{ contains(needs.version.outputs.version, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}