-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (58 loc) · 1.86 KB
/
tag-and-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
48
49
50
51
52
53
54
55
56
57
58
59
---
name: "Release"
on:
pull_request:
types:
- closed
branches:
- main
- dev
paths-ignore:
- "readme.md"
- ".gitignore"
- ".gitattributes"
- ".vscode/**"
- ".idea/**"
- ".github/**"
jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'
- name: release or prerelease
id: release_type
run: |
if [[ "${{ github.event.pull_request.base.ref }}" == "main" ]]; then
echo "This is a release"
echo "PRERELEASE=false" >> $GITHUB_OUTPUT
else
echo "This is a prerelease"
echo "PRERELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Bump version and push tag
id: tag
uses: anothrNick/[email protected] # Don't use @master or @v1 unless you're happy to test the latest version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
PRERELEASE_SUFFIX: dev
PRERELEASE: "${{ steps.release_type.outputs.PRERELEASE }}"
- name: Create prerelease
if: steps.release_type.outputs.PRERELEASE == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.tag.outputs.new_tag }} --title "Dev ${{ steps.tag.outputs.new_tag }}" --prerelease --generate-notes --verify-tag
- name: Create release
if: steps.release_type.outputs.PRERELEASE == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ steps.tag.outputs.new_tag }} --title "Release ${{ steps.tag.outputs.new_tag }}" --generate-notes --verify-tag