-
Notifications
You must be signed in to change notification settings - Fork 16
39 lines (35 loc) · 1.1 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
name: Release
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-22.04
steps:
- name: Read version from Git ref
id: version
shell: pwsh
run: echo "version=$(if ($env:GITHUB_REF.StartsWith('refs/tags/v')) { $env:GITHUB_REF -replace '^refs/tags/v', '' } else { 'next' })" >> $env:GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- name: Read the changelog
uses: ForNeVeR/ChangelogAutomation.action@v2
with:
input: ./CHANGELOG.md
output: ./changelog-section.md
- if: startsWith(github.ref, 'refs/tags/v')
name: Create a release
shell: pwsh
run: gh release create --title $env:TITLE --notes-file $env:RELEASE_NOTES_FILE $env:VERSION_TAG
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: 'Refasmer v${{ steps.version.outputs.version }}'
RELEASE_NOTES_FILE: './changelog-section.md'
VERSION_TAG: 'v${{ steps.version.outputs.version }}'