forked from advanced-security/reusable-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.86 KB
/
release.yml
File metadata and controls
87 lines (73 loc) · 2.86 KB
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
# GitHub Releasing Workflow
name: GitHub - Release
on:
workflow_dispatch:
inputs:
bump:
type: choice
description: "The type of version bump to perform"
options:
- patch
- minor
- major
workflow_call:
inputs:
version:
description: "The version to release"
required: true
type: string
jobs:
release-next:
runs-on: ubuntu-latest
# If the workflow was triggered by workflow_dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
permissions:
contents: write
pull-requests: write
steps:
- name: "Checkout"
uses: actions/checkout@v6
- name: "Patch Release Me"
uses: 42ByteLabs/patch-release-me@ef44b04c04fde87280adf14548664bfbcebba04d # 0.6.4
with:
mode: ${{ github.event.inputs.bump }}
- name: "Create Release"
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ github.token }}
commit-message: "[chore]: Create release for ${{ github.event.inputs.version }}"
title: "[chore]: Create release for ${{ github.event.inputs.version }}"
branch: chore-release-${{ github.event.inputs.version }}
base: ${{ github.event.before }}
labels: version
body: |
This is an automated PR to create a new release. The release will be created once this PR is merged.
release:
runs-on: ubuntu-latest
# If the workflow was triggered by a workflow call and the version is not null
if: ${{ github.event_name == 'workflow_call' && github.event.inputs.version != null }}
permissions:
contents: write
steps:
# https://github.com/peter-murray/semver-data-action
- name: Parse SemVer
id: version
uses: peter-murray/semver-action@5a07021b987a48fb9129231397615329ad74703c # v1.0.1
with:
version: ${{ inputs.version }}
# Tags :: ${Full}, v${Major}, v${Major}.${Minor}, v${Major}.${Minor}.${Patch}
- name: "GitHub Release"
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag "${{ steps.version.outputs.version }}" --force
git tag "v${{ steps.version.outputs.major }}" --force
git tag "v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}" --force
git tag "v${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}" --force
git push origin ${{ github.ref_name }}
git push origin --tags --force
gh release create --latest --generate-notes \
--title "v${{ steps.version.outputs.version }}" \
"${{ steps.version.outputs.version }}"