Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 117 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
---
name: CI

'on':
- push
- pull_request
on:
push:
tags:
- '*'
branches:
- master
- fork-master
- 'release-*'
pull_request:
branches:
- master
- fork-master
- 'release-*'

env:
GOPROXY: https://proxy.golang.org
Expand All @@ -18,7 +28,16 @@ jobs:
with:
go-version: 1.16.7

- uses: actions/checkout@v2
- name: checkout full
uses: actions/checkout@v2
if: startsWith(github.ref, 'refs/tags/')
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops
fetch-depth: 0

- name: checkout shallow
uses: actions/checkout@v2
if: startsWith(github.ref, 'refs/tags/') == false
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops

Expand All @@ -27,39 +46,84 @@ jobs:
run: |
make all examples test

- name: upload linux binary
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v2
with:
name: kops-linux-amd64
path: ${{ env.GOPATH }}/src/k8s.io/kops/.build/local/kops
if-no-files-found: error
retention-days: 1

build-macos-amd64:
runs-on: macos-10.15
steps:
- name: Set up go
uses: actions/setup-go@v2
with:
go-version: 1.16.7
- name: Set up go
uses: actions/setup-go@v2
with:
go-version: 1.16.7

- uses: actions/checkout@v2
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops
- name: checkout full
uses: actions/checkout@v2
if: startsWith(github.ref, 'refs/tags/')
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops
fetch-depth: 0

- 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: make kops examples test
working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
run: |
make kops examples test

- name: upload 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/local/kops
if-no-files-found: error
retention-days: 1

build-windows-amd64:
runs-on: windows-2019
steps:
- name: Set up go
uses: actions/setup-go@v2
with:
go-version: 1.16.7
- name: Set up go
uses: actions/setup-go@v2
with:
go-version: 1.16.7

- name: checkout full
uses: actions/checkout@v2
if: startsWith(github.ref, 'refs/tags/')
with:
path: ${{ env.GOPATH }}/src/k8s.io/kops
fetch-depth: 0

- uses: actions/checkout@v2
with:
path: ${{ 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-windows
- name: make kops examples test
working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
run: |
make kops examples test-windows

- name: upload windows binary
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v2
with:
name: kops-windows-amd64
path: ${{ env.GOPATH }}/src/k8s.io/kops/.build/local/kops
if-no-files-found: error
retention-days: 1

verify:
runs-on: ubuntu-20.04
Expand All @@ -77,3 +141,30 @@ jobs:
working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
run: |
make quick-ci

release:
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
needs:
- build-linux-amd64
- build-macos-amd64
- build-windows-amd64
- verify
steps:
- name: Download all kops binary artifacts
uses: actions/download-artifact@v2

- name: rename kops binary artifacts
run: |
mv kops-linux-amd64/kops kops-linux-amd64/kops-linux-amd64
mv kops-darwin-amd64/kops kops-darwin-amd64/kops-darwin-amd64
mv kops-windows-amd64/kops kops-windows-amd64/kops-windows-amd64

- name: Release
uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
kops-linux-amd64/kops-linux-amd64
kops-darwin-amd64/kops-darwin-amd64
kops-windows-amd64/kops-windows-amd64
1 change: 1 addition & 0 deletions tools/get_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ if [[ -n "${CI}" ]]; then
EXACT_TAG=$(git describe --tags --exact-match 2>/dev/null || true)
if [[ -n "${EXACT_TAG}" ]]; then
VERSION="${EXACT_TAG#v}" # Remove the v prefix from the git tag
VERSION="${VERSION//-bearingpoint*/}" # remove the bearingpoint version from the tag
if [[ "${VERSION}" != "${KOPS_RELEASE_VERSION}" ]]; then
echo "Build was tagged with ${VERSION}, but version.go had version ${KOPS_RELEASE_VERSION}"
exit 1
Expand Down