diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8dc293ce1513f..7b8460416c5f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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