-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (75 loc) · 2.53 KB
/
cicd.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
name: CI/CD
on: push
jobs:
test_and_release:
name: CI/CD
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Run tests
run: go test -v ./...
- name: Get release version
if: startsWith(github.ref, 'refs/tags/')
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build tools
if: startsWith(github.ref, 'refs/tags/')
env:
VERSION: ${{ env.RELEASE_VERSION }}
run: make cli-all-arch
- name: Create release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./out/runplugin-linux-amd64
./out/runplugin-linux-arm64
./out/runplugin-darwin-amd64
./out/runplugin-darwin-arm64
./out/runplugin-windows-amd64
./out/pluginctl-linux-amd64
./out/pluginctl-linux-arm64
./out/pluginctl-darwin-amd64
./out/pluginctl-darwin-arm64
./out/pluginctl-windows-amd64
./out/sesctl-linux-amd64
./out/sesctl-linux-arm64
./out/sesctl-darwin-amd64
./out/sesctl-darwin-arm64
./out/sesctl-windows-amd64
./out/sha1sum.txt
./out/sha256sum.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
push_to_registry:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
env:
REGISTRY: docker.io
IMAGE_NAME: waggle/scheduler
steps:
- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up QEMU for multi-arch builds
uses: docker/setup-qemu-action@v1
- name: Set up Docker buildx for multi-arch builds
uses: docker/setup-buildx-action@v1
- name: Login to Github Package Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
build-args: VERSION=${{ env.RELEASE_VERSION }}
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}