-
Notifications
You must be signed in to change notification settings - Fork 95
57 lines (53 loc) · 2.08 KB
/
cut_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
56
57
name: Release tagging
on:
push:
branches:
- 'master'
paths:
- 'chart/k8gb/Chart.yaml'
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
cut_release:
runs-on: ubuntu-20.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@f8b229487278099721572481264761b1d4fdd530
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- uses: actions/checkout@f095bcc56b7c2baf48f3ac70d6d6782f4f553222
with:
fetch-depth: 0
- name: Get Desired Tag
run: |
tag=$(awk '/appVersion:/ {print $2}' chart/k8gb/Chart.yaml)
echo "Version to release: ${tag}"
echo "desired_tag=${tag}" >> $GITHUB_ENV
- name: Push Tag
if: startsWith(github.event.head_commit.message, 'RELEASE:')
uses: mathieudutour/github-tag-action@fcfbdceb3093f6d85a3b194740f8c6cec632f4e2 #v6.1
with:
github_token: ${{ secrets.CR_TOKEN }}
create_annotated_tag: true
tag_prefix: ""
custom_tag: ${{ env.desired_tag }}
- name: Get Current Tag
if: startsWith(github.event.head_commit.message, 'Revert "RELEASE:')
run: |
tag=$(git describe --tags --abbrev=0)
echo "Version to revert: ${tag}"
echo "current_tag=${tag}" >> $GITHUB_ENV
- name: Get Previous Tag
if: startsWith(github.event.head_commit.message, 'Revert "RELEASE:')
run: |
tag=$(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)
echo "Previous tag: ${tag}"
echo "previous_tag=${tag}" >> $GITHUB_ENV
- name: Delete Tag and Release
if: startsWith(github.event.head_commit.message, 'Revert "RELEASE:') && env.desired_tag == env.previous_tag
uses: dev-drprasad/delete-tag-and-release@7550ea180f81ca0a875ee3c135b1f72ef66ff4b1
with:
delete_release: true # default: false
tag_name: ${{ env.current_tag }}
env:
GITHUB_TOKEN: ${{ secrets.CR_TOKEN }}