changed: tidy up the main example #36
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
name: Go - CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
lint: | |
name: Lint Code | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 | |
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: '1.21' | |
cache: false | |
- name: Run GolangCI Linter | |
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3 | |
with: | |
version: v1.54 | |
build: | |
name: Build Artifacts | |
needs: ["lint"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 | |
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: '1.21' | |
cache: false | |
- name: Setup Golang Caches | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@5fdedb94abba051217030cc86d4523cf3f02243d # v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache Artifacts | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 | |
with: | |
path: dist | |
key: dist | |
upload: | |
name: Upload Artifacts - ${{ matrix.os.name }} | |
needs: ["build"] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: Linux | |
id: linux | |
- name: MacOS | |
id: darwin | |
- name: Windows | |
id: windows | |
steps: | |
- name: Get Cached Artifacts | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 | |
with: | |
path: dist | |
key: dist | |
# The upload-artifact action doesn't support multi upload 🤷♂️! | |
- name: Upload Artifacts - AMD | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
with: | |
name: merger-${{ matrix.os.id }}-amd | |
path: dist/kustomize-plugin-merger_${{ matrix.os.id }}_amd*/kustomize-plugin-merger* | |
- name: Upload Artifacts - ARM | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
with: | |
name: merger-${{ matrix.os.id }}-arm | |
path: dist/kustomize-plugin-merger_${{ matrix.os.id }}_arm*/kustomize-plugin-merger* |