-
Notifications
You must be signed in to change notification settings - Fork 3
91 lines (77 loc) · 2.59 KB
/
main-merge.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
name: Build and push
on:
push:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: checkly/checkly-operator
USE_EXISTING_CLUSTER: true
GO_MODULES: on
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v1
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Start kind cluster
uses: helm/[email protected]
with:
version: "v0.22.0" # This starts k8s v1.29
- name: Test code
env:
USE_EXISTING_CLUSTER: true
run: |
make test-ci
# Sonarcloud
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# GO_MODULES: "on"
# Docker buildx does not allow for multi architecture builds and loading the docker container locally,
# this way we can not run trivy against the containers, one solution is to run multiple jobs for each arch
docker:
name: Docker build
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v1
# For multi-arch docker builds
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: NPM Install packages for semantic-release
run: |
npm install
- name: Release
uses: cycjimmy/semantic-release-action@v3
id: semantic # The `id` for output variables
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build multi-platform images
uses: docker/build-push-action@v2
if: ${{ steps.semantic.outputs.new_release_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE: ${{ env.REGISTRY }}/${{env.IMAGE_NAME}}:${{ steps.semantic.outputs.new_release_version }}
with:
context: .
platforms: linux/amd64, linux/arm, linux/arm64
push: true
tags: ${{ env.IMAGE }}