Skip to content

Commit

Permalink
WIP: improve ci workflow (do double trigger, all bins release)
Browse files Browse the repository at this point in the history
  • Loading branch information
ederst committed Aug 27, 2021
1 parent a0c239a commit 9e15d8b
Showing 1 changed file with 90 additions and 91 deletions.
181 changes: 90 additions & 91 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 Down Expand Up @@ -36,109 +46,98 @@ jobs:
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

# - uses: actions/checkout@v2
# 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 macos binary
# if: startsWith(github.ref, 'refs/tags/')
# uses: actions/upload-artifact@v2
# with:
# name: kops-macos
# path: ./build/local/kops
# if-no-files-found: error

# build-windows-amd64:
# runs-on: windows-2019
# steps:
# - 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: make kops examples test
# working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
# run: |
# make kops examples test-windows

# - name: upload win binary
# if: startsWith(github.ref, 'refs/tags/')
# uses: actions/upload-artifact@v2
# with:
# name: kops-win
# path: ./build/local/kops
# if-no-files-found: error

# verify:
# runs-on: ubuntu-20.04
# steps:
# - 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: make quick-ci
# working-directory: ${{ env.GOPATH }}/src/k8s.io/kops
# run: |
# make quick-ci
build-macos-amd64:
runs-on: macos-10.15
steps:
- 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: 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

- uses: actions/checkout@v2
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: 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
steps:
- 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: 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/')
needs:
- build-linux-amd64
# - build-macos-amd64
# - build-windows-amd64
# - verify
- build-macos-amd64
- build-windows-amd64
- verify
steps:
- name: Download all kops binary artifacts
uses: actions/download-artifact@v2

# - name: Display structure
# run: ls -R

- name: renamve kops binary artifacts
- name: rename kops binary artifacts
run: |
mv kops-linux-amd64/kops kops-linux-amd64/kops-linux-amd64
# - name: Download kops macos binary
# uses: actions/download-artifact@v2
# with:
# name: kops-macos
# path: kops-macos

# - name: Download kops windows binary
# uses: actions/download-artifact@v2
# with:
# name: kops-win
# path: kops-win
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-macos
# kops-win
kops-darwin-amd64/kops-darwin-amd64
kops-windows-amd64/kops-windows-amd64

0 comments on commit 9e15d8b

Please sign in to comment.