fixing cache issue #22
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow is triggered on new tags. | |
# It runs tests to validate that the code is working before publishing a new | |
# version for plugin "lineage" in krew-index. | |
name: release | |
on: | |
push: | |
tags: | |
- "v*" # Trigger on tags that start with 'v', e.g., v1.0.0 | |
release: | |
types: [created] # Trigger when a GitHub Release is created | |
workflow_dispatch: # Allow manual triggering | |
env: | |
GO_VERSION: "1.22.4" | |
jobs: | |
release: | |
name: Release | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build binary (Unix) | |
if: matrix.os == 'ubuntu-latest' | |
run: CGO_ENABLED=0 GOOS=linux go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o kube-lineage-${{ matrix.os }}-${{ github.ref_name }} ./cmd/kube-lineage | |
- name: Build binary (Arm) | |
if: matrix.os == 'macos-latest' | |
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o kube-lineage-${{ matrix.os }}-${{ github.ref_name }} ./cmd/kube-lineage | |
- name: Build binary (Windows) | |
if: matrix.os == 'windows-latest' | |
run: CGO_ENABLED=0 GOOS=windows go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o kube-lineage.exe ./cmd/kube-lineage | |
- name: Upload Release Asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./kube-lineage-${{ matrix.os }}-${{ github.ref_name }} | |
asset_name: kube-lineage-${{ matrix.os }}-${{ github.ref_name }} | |
asset_content_type: application/octet-stream |