-
Notifications
You must be signed in to change notification settings - Fork 28
152 lines (133 loc) · 4.83 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
150
151
152
name: "Release"
on:
workflow_dispatch:
inputs:
version:
description: tag the latest commit on main with the given version (prefixed with v)
required: true
jobs:
quality-gate:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0
- name: Check if tag already exists
# note: this will fail if the tag already exists
run: |
git tag ${{ github.event.inputs.version }}
# we don't want to release commits that have been pushed and tagged, but not necessarily merged onto main
- name: Ensure tagged commit is on main
run: |
echo "Tag: ${GITHUB_REF##*/}"
git fetch origin main
git merge-base --is-ancestor ${GITHUB_REF##*/} origin/main && echo "${GITHUB_REF##*/} is a commit on main!"
- name: Check validation results
uses: fountainhead/action-wait-for-check@297be350cf8393728ea4d4b39435c7d7ae167c93 #v1.1.1
id: validations
with:
token: ${{ secrets.GITHUB_TOKEN }}
# This check name is defined as the github action job name (in .github/workflows/validations.yaml)
checkName: "Validations"
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Check nightly quality gate results
uses: fountainhead/action-wait-for-check@297be350cf8393728ea4d4b39435c7d7ae167c93 #v1.1.0
id: nightly-quality-gate
with:
token: ${{ secrets.GITHUB_TOKEN }}
# This check name is defined as the github action job name (in .github/workflows/nightly-quality-gate.yaml)
checkName: "Nightly-Quality-Gate"
ref: ${{ github.event.pull_request.head.sha || github.sha }}
# If there is no result in 10 seconds, assume it hasn't run yet
timeoutSeconds: 10
intervalSeconds: 3
- name: Release quality gate
if: steps.validations.conclusion != 'success' || steps.nightly-quality-gate.conclusion != 'success'
run: |
echo "Validations Status: ${{ steps.validations.conclusion }}"
echo "Nightly Quality Gate Status: ${{ steps.nightly-quality-gate.conclusion }}"
false
tag:
needs:
- quality-gate
runs-on: ubuntu-22.04
environment: release
permissions:
contents: write
packages: write
issues: read
pull-requests: read
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0
with:
# in order to properly resolve the version from git
fetch-depth: 0
- name: Tag release
run: |
git tag ${{ github.event.inputs.version }}
git push origin --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-pypi:
needs:
- tag
runs-on: ubuntu-22.04
environment: release
permissions:
contents: read
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0
with:
# in order to properly resolve the version from git
fetch-depth: 0
- name: Bootstrap environment
uses: ./.github/actions/bootstrap
- name: Publish to PyPI
run: make ci-publish-pypi
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.VUNNEL_PYPI_TOKEN }}
release-docker:
needs:
- tag
runs-on: ubuntu-22.04
environment: release
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0
with:
# in order to properly resolve the version from git
fetch-depth: 0
- name: Bootstrap environment
uses: ./.github/actions/bootstrap
- name: Login to ghcr.io
run: |
echo ${{ secrets.GITHUB_TOKEN }} | oras login ghcr.io --username ${{ github.actor }} --password-stdin
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: Promote commit image to release
run: |
make ci-promote-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-github:
needs:
- tag
runs-on: ubuntu-22.04
environment: release
permissions:
contents: write
packages: write
issues: read
pull-requests: read
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0
with:
# in order to properly resolve the version from git
fetch-depth: 0
- name: Bootstrap environment
uses: ./.github/actions/bootstrap
- name: Create github release
run: |
make changelog
gh release create ${{ github.event.inputs.version }} -F CHANGELOG.md -t ${{ github.event.inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}