Skip to content

Commit 569a720

Browse files
committed
.github/workflows: Add a release workflow for creating draft releases
Add a GHA release workflow that's triggered on tags that's responsible for building and pushing multi-arch (i.e. manifestlist) OLM container images using goreleaser. Goreleaser will also create a draft release, and generate a changelog since the previous tag. Rendering the release quickstart manifests is done after goreleaser has created this draft release as there's no easy way to hook this functionality into goreleaser after the docker images/manifestlists have been pushed but before release artifacts are generated. Use the 'softprops/action-gh-release' to update the newly created draft release with these quickstart manifests as assets. Signed-off-by: timflannagan <[email protected]>
1 parent fcecd13 commit 569a720

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

Diff for: .github/workflows/goreleaser.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: release
2+
on:
3+
pull_request:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.16
20+
21+
- name: Get the image tag
22+
if: startsWith(github.ref, 'refs/tags')
23+
run: |
24+
# Source: https://github.community/t/how-to-get-just-the-tag-name/16241/32
25+
if [[ $GITHUB_REF == refs/tags/* ]]; then
26+
echo IMAGE_TAG="${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
27+
fi
28+
29+
- name: Create a draft release
30+
uses: actions/create-release@v1
31+
id: release
32+
if: startsWith(github.ref, 'refs/tags')
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}
35+
with:
36+
draft: true
37+
tag_name: ${{ github.ref }}
38+
release_name: ${{ github.ref }}
39+
40+
- name: Docker Login
41+
uses: docker/login-action@v1
42+
if: startsWith(github.ref, 'refs/tags')
43+
with:
44+
registry: quay.io
45+
username: ${{ secrets.QUAY_USERNAME }}
46+
password: ${{ secrets.QUAY_PASSWORD }}
47+
48+
- name: Run GoReleaser
49+
uses: goreleaser/goreleaser-action@v2
50+
if: startsWith(github.ref, 'refs/tags')
51+
with:
52+
version: latest
53+
args: release --rm-dist
54+
env:
55+
GITHUB_TOKEN: ${{ github.token }}
56+
IMAGE_REPO: ${{ secrets.QUAY_USERNAME }}/olm
57+
PKG: github.com/operator-framework/operator-lifecycle-manager
58+
59+
- name: Generate quickstart release manifests
60+
if: startsWith(github.ref, 'refs/tags')
61+
run: make release ver=${{ env.IMAGE_TAG }} IMAGE_REPO=quay.io/${{ secrets.QUAY_USERNAME }}/olm
62+
63+
- name: Update release artifacts with rendered Kubernetes manifests
64+
uses: softprops/action-gh-release@v1
65+
if: startsWith(github.ref, 'refs/tags')
66+
with:
67+
name: ${{ env.IMAGE_TAG }}
68+
files: |
69+
deploy/upstream/quickstart/crds.yaml
70+
deploy/upstream/quickstart/olm.yaml
71+
deploy/upstream/quickstart/install.sh
72+
draft: true
73+
token: ${{ github.token }}

0 commit comments

Comments
 (0)