-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (87 loc) · 3.59 KB
/
gha-release-versioning.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
80
81
82
83
84
85
86
87
88
89
90
name: gha-release-versioning
#Note: Workflow is called by other workflows to a) determine a semantic version, b) tag the repo with this create a semantic version and c) create a release.
on:
workflow_dispatch:
workflow_call:
inputs:
# GITHUB_TOKEN:
# description: e.g. USD{{ secrets.GITHUB_TOKEN }}
# required: true
# type: string
#Note: We don't need to pass in GITHUB_TOKEN to a reusable workflow. When a reusable workflow is triggered by a caller workflow, the github context is always associated with the caller workflow. The called workflow is automatically granted access to github.token and secrets.GITHUB_TOKEN.
#see https://docs.github.com/en/actions/using-workflows/reusing-workflows
semVer:
description: Pass in an externally generated semantic version, if empty then uses GitVersion.
required: false
type: string
default: ''
tag-prefix:
description: Prefix the semver, e.g. 1.0.1 or v1.0.1
required: false
type: string
default: v
move-major-tag:
description: Create and/or move major version tag, e.g. when creating v1.0.2 then move v1 tag up from the v1.0.1 commit.
required: false
type: boolean
default: true
tag-and-release:
description: Sets a Git tag and creates a corresponding release.
required: false
type: boolean
default: true
gv-config:
description: Configuration filename that GitVersion will use.
type: string
default: GitVersion.yml
gv-source:
description: Choose an installation source for GitVersion, options include container, dotnet & actions.
type: string
default: actions
outputs:
version:
description: e.g. 1.2.301
value: ${{ jobs.gha-release-versioning.outputs.version }}
semVer:
description: e.g. 1.2.301
value: ${{ jobs.gha-release-versioning.outputs.semVer }}
fullSemVer:
description: e.g. 1.2.301-feature-my-feature.12
value: ${{ jobs.gha-release-versioning.outputs.fullSemVer }}
major:
description: e.g. 1
value: ${{ jobs.gha-release-versioning.outputs.major }}
minor:
description: e.g. 2
value: ${{ jobs.gha-release-versioning.outputs.minor }}
patch:
description: e.g. 301
value: ${{ jobs.gha-release-versioning.outputs.patch }}
release-exists:
description: e.g. true or false
value: ${{ jobs.gha-release-versioning.outputs.release-exists }}
jobs:
gha-release-versioning:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.gha-release-versioning.outputs.version }}
semVer: ${{ steps.gha-release-versioning.outputs.semVer }}
fullSemVer: ${{ steps.gha-release-versioning.outputs.fullSemVer }}
major: ${{ steps.gha-release-versioning.outputs.major }}
minor: ${{ steps.gha-release-versioning.outputs.minor }}
patch: ${{ steps.gha-release-versioning.outputs.patch }}
release-exists: ${{ steps.gha-release-versioning.outputs.release-exists }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: f2calv/gha-release-versioning@v1
id: gha-release-versioning
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
semVer: ${{ inputs.semVer }}
tag-prefix: ${{ inputs.tag-prefix }}
move-major-tag: ${{ inputs.move-major-tag }}
tag-and-release: ${{ inputs.tag-and-release }}
gv-config: ${{ inputs.gv-config }}
gv-source: ${{ inputs.gv-source }}