Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit 842458b

Browse files
authored
Automatic container build & publish when new release is created. (#61)
1 parent c62c9b6 commit 842458b

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Create operator's container image for the new release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
REGISTRY: quay.io
9+
TERM: xterm-color
10+
OPERATOR_IMAGE_NAME: testnetworkfunction/crd-operator-scaling
11+
OPERATOR_IMAGE_TAG: ${{ github.ref_name }}
12+
13+
jobs:
14+
publish-new-version:
15+
name: Build and publish new version
16+
runs-on: ubuntu-22.04
17+
env:
18+
SHELL: /bin/bash
19+
20+
steps:
21+
- name: Set up Go 1.20
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: 1.20.5
25+
26+
- name: Disable default go problem matcher
27+
run: echo "::remove-matcher owner=go::"
28+
29+
- name: Show release tag
30+
run: "echo Version: ${{ github.ref_name }}. Full image tag: ${OPERATOR_IMAGE_NAME}:${OPERATOR_IMAGE_TAG}"
31+
32+
# Clone the operator repo.
33+
- name: Check out crd-operator-scaling code
34+
uses: actions/checkout@v3
35+
with:
36+
ref: ${{ github.ref_name }}
37+
38+
# Deploy the CRD scaling repo and build it
39+
- name: Build operator and make local docker image
40+
run: make docker-build IMG=${OPERATOR_IMAGE_NAME}:${OPERATOR_IMAGE_TAG}
41+
42+
# Push the new operator image to Quay.io.
43+
- name: Authenticate against Quay.io
44+
if: ${{ github.repository_owner == 'test-network-function' }}
45+
uses: docker/login-action@v2
46+
with:
47+
registry: ${{ env.REGISTRY }}
48+
# Use a Robot Account to authenticate against Quay.io
49+
# https://docs.quay.io/glossary/robot-accounts.html
50+
username: ${{ secrets.QUAY_ROBOT_USERNAME }}
51+
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
52+
53+
- name: Push the newly built official image to Quay.io
54+
if: ${{ github.repository_owner == 'test-network-function' }}
55+
run: docker push ${REGISTRY}/${OPERATOR_IMAGE_NAME}:${OPERATOR_IMAGE_TAG}

0 commit comments

Comments
 (0)