-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (52 loc) · 1.71 KB
/
release.yml
File metadata and controls
56 lines (52 loc) · 1.71 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
name: 'Release'
on:
push:
branches:
- 'main'
- 'release/**/*'
jobs:
create-release:
if: "startsWith(github.event.head_commit.message, 'Release: v')"
runs-on: 'ubuntu-latest'
outputs:
created: '${{ steps.create-release.outputs.created || false }}'
tag: '${{ steps.create-release.outputs.tag }}'
version: '${{ steps.create-release.outputs.version }}'
steps:
- name: 'Create release'
id: 'create-release'
uses: 'abcxyz/pkg/.github/actions/create-release@main' # ratchet:exclude
with:
github_token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
expected_email: 'support@srcpush.com'
publish-release:
runs-on: 'ubuntu-latest'
needs:
- 'create-release'
steps:
- name: 'Publish release'
env:
GH_TOKEN: '${{ secrets.ACTIONS_BOT_TOKEN }}'
RELEASE_VERSION: 'v${{ needs.create-release.outputs.version }}'
REPO: '${{ github.repository }}'
run: |-
gh release edit "${RELEASE_VERSION}" \
--repo "${REPO}" \
--draft=false
cleanup-failed-release:
if: |-
${{ always() && needs.create-release.outputs.created == 'true' && contains(fromJSON('["failure", "cancelled", "skipped"]'), needs.publish-release.result) }}
runs-on: 'ubuntu-latest'
needs:
- 'create-release'
- 'publish-release'
steps:
- name: 'Cleanup failed release'
env:
GH_TOKEN: '${{ secrets.ACTIONS_BOT_TOKEN }}'
RELEASE_VERSION: 'v${{ needs.create-release.outputs.version }}'
REPO: '${{ github.repository }}'
run: |-
gh release delete "${RELEASE_VERSION}" \
--repo "${REPO}" \
--yes