-
Notifications
You must be signed in to change notification settings - Fork 50
149 lines (130 loc) · 4.51 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
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Release
on:
push:
tags:
- "*"
jobs:
release:
runs-on: self-hosted
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Checkout
uses: actions/checkout@v2
- name: Wait for build to succeed
uses: fountainhead/[email protected]
id: wait-for-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: conclude
ref: ${{ github.sha }}
timeoutSeconds: 6000
- name: Fail if the build did not succeed
if: steps.wait-for-build.outputs.conclusion == 'failure'
run: exit 1
# increase our chances of getting the artifacts on 1st try
- name: Delay
run: sleep 20
# It may take some time for the workflow to finish and the artifacts to appear
# FIXME: https://github.com/dawidd6/action-download-artifact/issues/43
- name: Get debug image name
uses: dawidd6/action-download-artifact@v2
continue-on-error: true
id: download
with:
workflow: main.yaml
workflow_conclusion: success
commit: ${{github.sha}}
name: image-debug
# FIXME: no clean way to retry the action
- name: Delay
if: steps.download.outcome=='failure'
run: sleep 40
- name: Retry download (1)
if: steps.download.outcome=='failure'
uses: dawidd6/action-download-artifact@v2
continue-on-error: true
id: download1
with:
workflow: main.yaml
workflow_conclusion: success
commit: ${{github.sha}}
name: image-debug
- name: Delay
if: steps.download1.outcome=='failure'
run: sleep 80
- name: Retry download (2)
if: steps.download1.outcome=='failure'
uses: dawidd6/action-download-artifact@v2
with:
workflow: main.yaml
workflow_conclusion: success
commit: ${{github.sha}}
name: image-debug
- name: Promote (retag) the debug image
env:
REGISTRY_LOGIN: ${{ secrets.QUAY_USER_ID }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_TOKEN }}
run: |
# hack/retag-unexpire.sh quay.io travelping/upg source_tag dest_tag
hack/retag-unexpire.sh $(sed 's@/@ @;s/:/ /' image-debug.txt) "${GITHUB_REF##*/}_debug"
- name: Get release image name
uses: dawidd6/action-download-artifact@v2
with:
workflow: main.yaml
workflow_conclusion: success
commit: ${{github.sha}}
name: image-release
- name: Promote (retag) the release image
env:
REGISTRY_LOGIN: ${{ secrets.QUAY_USER_ID }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_TOKEN }}
run: |
# hack/retag-unexpire.sh quay.io travelping/upg source_tag dest_tag
hack/retag-unexpire.sh $(sed 's@/@ @;s/:/ /' image-release.txt) "${GITHUB_REF##*/}_release"
- name: Get dev release image name
uses: dawidd6/action-download-artifact@v2
with:
workflow: main.yaml
workflow_conclusion: success
commit: ${{github.sha}}
name: image-dev-release
- name: Promote (retag) the dev release image
env:
REGISTRY_LOGIN: ${{ secrets.QUAY_USER_ID }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_TOKEN }}
run: |
hack/retag-unexpire.sh $(sed 's@/@ @;s/:/ /' image-dev-release.txt) "${GITHUB_REF##*/}_dev_release"
- name: Get dev debug image name
uses: dawidd6/action-download-artifact@v2
with:
workflow: main.yaml
workflow_conclusion: success
commit: ${{github.sha}}
name: image-dev-debug
- name: Promote (retag) the dev debug image
env:
REGISTRY_LOGIN: ${{ secrets.QUAY_USER_ID }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_TOKEN }}
run: |
hack/retag-unexpire.sh $(sed 's@/@ @;s/:/ /' image-dev-debug.txt) "${GITHUB_REF##*/}_dev_debug"
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v1
if: ${{ !contains(github.ref, 'test') }}
with:
configuration: "changelog-config.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Post the release
uses: softprops/action-gh-release@v1
# TODO: prerelease for 'pre'
# TODO: no release for 'test'
if: ${{ !contains(github.ref, 'test') }}
with:
body: ${{ steps.build_changelog.outputs.changelog }}
prerelease: ${{ contains(github.ref, 'pre') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}