-
Notifications
You must be signed in to change notification settings - Fork 68
154 lines (135 loc) · 4.29 KB
/
publish.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
153
154
name: Release
on:
push:
# Sequence of patterns matched against refs/tags
branches:
- "main"
- "v[0-9]+.[0-9]+"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+"
jobs:
main:
runs-on: ubuntu-20.04
strategy:
matrix:
go: ["1.21"]
name: Go ${{ matrix.go }}
steps:
- name: Checkout Metal LB Operator
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-go@v2
id: go
with:
go-version: ${{ matrix.go }}
- name: Verify modules
run: go mod verify
- name: Verify format
run: |
make fmt
git diff --exit-code
- name: Verify release bundle manifests
run: |
make bundle-release
git diff --exit-code -I'^ createdAt: ' bundle
- name: Create and set up K8s Kind Cluster
run: |
./hack/kind-cluster-with-registry.sh
make deploy-olm
- name: Build bundle image
run: |
make build-and-push-bundle-images REPO=localhost:5000
- name: Deploy Metal LB Operator with OLM
run: |
make deploy-with-olm REPO=localhost:5000
- name: E2E Tests
run: |
export KUBECONFIG=${HOME}/.kube/config
make test-validation
SKIP="frr-k8s" make test-e2e
- name: Archive E2E Tests logs
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: test_e2e_logs
path: /tmp/test_e2e_logs/
- name: Export kind logs
if: ${{ failure() }}
run: |
kind export logs /tmp/kind_logs
- name: Archive kind logs
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: kind_logs
path: /tmp/kind_logs
publish-image:
needs: [main]
runs-on: ubuntu-20.04
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Code checkout
uses: actions/checkout@v3
- name: Setup docker buildx
uses: docker/setup-buildx-action@v2
- name: Log into Quay
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
quay.io/metallb/metallb-operator
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=semver,pattern={{raw}}
labels: |
org.opencontainers.image.title=metallboperator
org.opencontainers.image.description=operator for metallb, a network load-balancer implementation for Kubernetes using standard routing protocols
- name: Build and push metallboperator
uses: docker/build-push-action@v3
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le,linux/arm/v7
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
build-args: |
GIT_BRANCH: ${{ github.ref_name }}
GIT_COMMIT: ${{ github.sha }}
release:
needs: [publish-image]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') # we craft releases only for tags
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ${{steps.build_changelog.outputs.changelog}}
draft: false
prerelease: false