Skip to content

Commit

Permalink
add pre-built builder to main workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ypoplavs committed May 10, 2022
1 parent 3c16a77 commit b8280b6
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 25 deletions.
1 change: 0 additions & 1 deletion .github/workflows/release-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+-*"
- "v[0-9]+.[0-9]+.[0-9]+-test*"


jobs:
# release_creation:
# name: Prepares Release on GitHub
Expand Down
79 changes: 73 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-test*"

jobs:
# release_creation:
Expand All @@ -26,8 +27,59 @@ jobs:
# draft: false
# prerelease: false

pre_build:
name: Pre-build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: "linux"
path: .builds-linux.goreleaser-dev.yml
- name: "windows"
path: .builds-windows.goreleaser-dev.yml
- name: "darwin"
path: .builds-darwin.goreleaser-dev.yml
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Go Cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser-pro
version: latest
args: release -f ${{ matrix.path }} --skip-publish
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
ANALYTICS_TRACKING_ID: "${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_ID}}"
ANALYTICS_API_KEY: "${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_SECRET}}"
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload Artifacts
uses: actions/upload-artifact@master
with:
name: testkube_${{ matrix.name }}
path: |
${{ matrix.name }}/testkube_${{ matrix.name }}_*
retention-days: 1

release:
name: Create and upload release-artifacts
needs: pre_build
# needs: [release_creation]
runs-on: ubuntu-latest

Expand All @@ -36,6 +88,21 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download Artifacts for Linux
uses: actions/download-artifact@master
with:
name: testkube_linux
path: linux
- name: Download Artifacts for Windows
uses: actions/download-artifact@master
with:
name: testkube_windows
path: windows
- name: Download Artifacts for Darwin
uses: actions/download-artifact@master
with:
name: testkube_darwin
path: darwin
- name: Set up Go
uses: actions/setup-go@v2
with:
Expand All @@ -52,15 +119,15 @@ jobs:
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
distribution: goreleaser-pro
version: latest
args: release --rm-dist
args: release -f .goreleaser.yml
env:
GITHUB_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
ANALYTICS_TRACKING_ID: "${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_ID}}"
ANALYTICS_API_KEY: "${{secrets.TESTKUBE_CLI_GA_MEASUREMENT_SECRET}}"
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Store Intermediate Artifacts
uses: actions/upload-artifact@master
with:
Expand Down Expand Up @@ -96,8 +163,8 @@ jobs:
- name: Get Intermediate Artifacts
uses: actions/download-artifact@master
with:
name: bin-artifacts
path: dist
name: testkube_windows
path: windows

- name: Get MSFT Cert
id: write_file
Expand All @@ -109,7 +176,7 @@ jobs:

- name: Create and Sign MSI
run: |
Copy-Item 'dist\testkube_windows_386\kubectl-testkube.exe' '.\kubectl-testkube.exe'
Copy-Item 'windows\testkube_windows_386\kubectl-testkube.exe' '.\kubectl-testkube.exe'
Copy-Item 'build\installer\windows\testkube.wxs' '.\testkube.wxs'
& "$env:WIX\bin\candle.exe" *.wxs
& "$env:WIX\bin\light.exe" *.wixobj
Expand Down
32 changes: 14 additions & 18 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
before:
hooks:
- go mod tidy
builds:
- main: ./cmd/kubectl-testkube
binary: kubectl-testkube
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
ldflags:
- -s -w -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
- -X main.builtBy=goreleaser
- -X github.com/kubeshop/testkube/pkg/analytics.TestkubeMeasurementID={{.Env.ANALYTICS_TRACKING_ID}}
- -X github.com/kubeshop/testkube/pkg/analytics.TestkubeMeasurementSecret={{.Env.ANALYTICS_API_KEY}}
- builder: prebuilt
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- 386
goamd64:
- v1
prebuilt:
path: '{{ .Os }}/testkube_{{ .Os }}_{{ .Arch }}{{ with .Amd64 }}_{{ . }}{{ end }}/kubectl-testkube{{ .Ext }}'
binary: kubectl-testkube
archives:
- replacements:
darwin: macOS
Expand Down

0 comments on commit b8280b6

Please sign in to comment.