-
Notifications
You must be signed in to change notification settings - Fork 44
95 lines (79 loc) · 2.45 KB
/
release.yml
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
name: release flannel cni-plugin
on:
# You must provide a tag either via the action input or the git ref (i.e push / create a tag).
# If you do not provide a tag the action will fail.
# If the tag of the release you are creating does not yet exist, you should set
# both the tag and commit action inputs. commit can point to a commit hash or a branch name (ex - main).
# workflow_dispatch:
# inputs:
# branch:
# description: 'Define branch name to run the release GH action against'
# required: true
# default: 'main'
release:
types:
- created
env:
GO_VERSION: "1.23.3"
REPOSITORY: flannel/flannel-cni-plugin
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: go mod vendor and tidy
run: make vendor
- name: build all binaries for release
run: make build_all
- name: run tests
run: make test_linux
- name: run go vet
run: go vet
- name: create packages for release
if: success()
run: make release
- name: Upload release files
uses: softprops/action-gh-release@v1
with:
files: |
dist/*
release/*
build-and-push-images:
needs: [build-and-release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
if: success()
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REPOSITORY }}
flavor: latest=false
tags: |
type=ref,event=tag
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
# if: github.repository_owner == 'flannel-io' && success()
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.image
push: true
platforms: linux/amd64,linux/arm64,linux/arm,linux/s390x,linux/ppc64le,linux/riscv64
tags: ${{ steps.meta.outputs.tags }}