forked from kubernetes/kops
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (138 loc) · 4.51 KB
/
main.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
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
155
156
157
158
159
name: CI
on:
push:
tags:
- "*"
branches:
- "master*"
- "release*"
pull_request:
branches:
- "master*"
- "release*"
env:
GOPROXY: https://proxy.golang.org
GOPATH: ${{ github.workspace }}/go
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Detect changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- '!.github/**'
build-linux-amd64:
needs: changes
if: ${{ needs.changes.outputs.src == 'true' || startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-20.04
steps:
- name: Set up go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: "1.21.6"
- name: Checkout full
if: startsWith(github.ref, 'refs/tags/')
run: |
git clone ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} -b ${GITHUB_REF#refs/tags/} ${{ env.GOPATH }}/src/k8s.io/kops
- name: Checkout shallow
uses: actions/checkout@v2
if: startsWith(github.ref, 'refs/tags/') == false
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops
- name: Make all examples test
working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
run: |
make all examples test
- name: Upload Linux binaries
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v2
with:
name: kops-linux-amd64
path: ${{ env.GOPATH }}/src/k8s.io/kops/.build/dist/linux/amd64/*
if-no-files-found: error
retention-days: 1
build-macos-amd64:
needs: changes
if: ${{ needs.changes.outputs.src == 'true' || startsWith(github.ref, 'refs/tags/') }}
runs-on: macos-latest
steps:
- name: Set up go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: "1.21.6"
- name: Checkout full
if: startsWith(github.ref, 'refs/tags/')
run: |
git clone ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} -b ${GITHUB_REF#refs/tags/} ${{ env.GOPATH }}/src/k8s.io/kops
- name: Checkout shallow
uses: actions/checkout@v2
if: startsWith(github.ref, 'refs/tags/') == false
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops
- name: Make kops examples test
working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
run: |
make kops examples test
- name: Upload kops MacOS binary
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v2
with:
name: kops-darwin-amd64
path: ${{ env.GOPATH }}/src/k8s.io/kops/.build/dist/darwin/amd64/kops
if-no-files-found: error
retention-days: 1
verify:
needs: changes
if: ${{ needs.changes.outputs.src == 'true' || startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-20.04
steps:
- name: Set up go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: "1.21.6"
- name: Checkout repository
uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops
- name: Make quick-ci
working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
run: |
make quick-ci
release:
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
needs:
- build-linux-amd64
- build-macos-amd64
- verify
steps:
- name: Download all binary artifacts
uses: actions/download-artifact@v2
- name: Rename kops binary artifacts
run: |
mv kops-darwin-amd64/kops kops-darwin-amd64/kops-darwin-amd64
mv kops-linux-amd64/kops kops-linux-amd64/kops-linux-amd64
mv kops-linux-amd64/channels kops-linux-amd64/channels-linux-amd64
mv kops-linux-amd64/protokube kops-linux-amd64/protokube-linux-amd64
mv kops-linux-amd64/nodeup kops-linux-amd64/nodeup-linux-amd64
- name: Release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
kops-darwin-amd64/kops-darwin-amd64
kops-linux-amd64/kops-linux-amd64
kops-linux-amd64/channels-linux-amd64
kops-linux-amd64/protokube-linux-amd64
kops-linux-amd64/nodeup-linux-amd64