-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (50 loc) · 1.56 KB
/
release.yaml
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
name: Release
run-name: Release ${{ inputs.version }}
permissions:
# Required for tag push and release creation
# https://docs.github.com/en/rest/overview/permissions-required-for-github-apps?apiVersion=2022-11-28#contents
contents: write
on:
workflow_dispatch:
inputs:
version:
type: string
description: "Tagging version (ex: v1.0.1)"
required: true
isMajorVersion:
type: boolean
description: If true, it will update the major version of the tag.
default: true
isRelease:
type: boolean
description: If true, it will create a GitHub Release.
default: true
jobs:
tagging-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
git tag ${{ inputs.version }}
git push --tags origin ${{ inputs.version }}
tagging-major-version-only:
# Make it available by specifying a major version, such as `renovate-dry-run-action@v1`.
runs-on: ubuntu-latest
if: ${{ inputs.isMajorVersion }}
steps:
- uses: actions/checkout@v4
- run: |
MAJOR_VERSION=$(echo ${{ inputs.version }} | awk -F'.' '{print $1}')
echo $MAJOR_VERSION
git tag --force $MAJOR_VERSION
git push --force --tags origin $MAJOR_VERSION
release:
runs-on: ubuntu-latest
if: ${{ inputs.isRelease }}
needs: tagging-version
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- run: |
gh release create ${{ inputs.version }} --generate-notes --draft