-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 2.84 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Bump and Release
on:
push:
branches:
- main
jobs:
release:
name: release
runs-on: ubuntu-latest
outputs:
EXISTING_TAG: ${{ steps.check_tag.outputs.EXISTING_TAG }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0' # 0 indicates all history for all branches and tags (https://github.com/actions/checkout)
# To deploy v1.0.0 commit requires message to include #major
# To bump to a minor version (default) v1.1.0 use #minor
# To bump Patch version v1.1.1 use #patch in commit message
# If missing initial Tag and release this will fail on first run
# This will add if tag does not exists
- name: Check for existing tag
id: check_tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "EXISTING_TAG=$(git describe --tags)" >> $GITHUB_OUTPUT
# Updating module version using semantic versioning
- name: Initial tag and release
if: ${{ steps.check_tag.outputs.EXISTING_TAG == '' }}
id: initial_release
uses: anothrNick/github-tag-action@ce4b5ffa38e072fa7a901e417253c438fcc2ccce # v1.36.0 https://github.com/anothrNick/github-tag-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true # Append version number with 'v'
DEFAULT_BUMP: major
# Create initial release
- name: Create GitHub Release
if: ${{ steps.check_tag.outputs.EXISTING_TAG == '' }}
uses: actions/create-release@v1 # https://github.com/actions/create-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{steps.initial_release.outputs.tag}}
body: "Initial Release"
# Bump and release
- name: Bump version and push tag
if: ${{ steps.check_tag.outputs.EXISTING_TAG }}
id: bump_version
uses: anothrNick/github-tag-action@ce4b5ffa38e072fa7a901e417253c438fcc2ccce # v1.36.0 https://github.com/anothrNick/github-tag-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true # Append version number with 'v'
# Return changelog between two git references
- name: Generate changelog
if: ${{ steps.check_tag.outputs.EXISTING_TAG }}
id: changelog
uses: metcalfc/[email protected] # v3.0.0 https://github.com/metcalfc/changelog-generator
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
# Create the release and changelog
- name: Create GitHub Release
if: ${{ steps.check_tag.outputs.EXISTING_TAG }}
uses: actions/create-release@v1 # https://github.com/actions/create-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{steps.bump_version.outputs.tag}}
body: ${{steps.changelog.outputs.changelog}} # Adds Changelog differences between latest git references to release