feat: Publish multiplatform images for Ubuntu (#20155) #5741
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: CLI Workflow | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
paths: | |
- "cli/**" | |
- ".github/workflows/cli.yml" | |
push: | |
branches: | |
- main | |
paths: | |
- "cli/**" | |
- ".github/workflows/cli.yml" | |
env: | |
CLOUDQUERY_API_KEY: ${{ secrets.CLOUDQUERY_API_KEY }} | |
jobs: | |
cli: | |
timeout-minutes: 30 | |
name: "cli" | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: ./cli | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: cli/go.mod | |
cache: true | |
cache-dependency-path: cli/go.sum | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
version: v1.62.2 | |
working-directory: cli | |
- name: Build | |
run: go build . | |
- name: Test | |
run: make test | |
- name: gen | |
if: matrix.os == 'ubuntu-latest' | |
run: make gen | |
- name: Fail if cli files are changed | |
if: matrix.os == 'ubuntu-latest' | |
run: test "$(git status -s | wc -l)" -eq 0 || (git status -s; exit 1) | |
validate-release: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
env: | |
CGO_ENABLED: 0 | |
steps: | |
- name: Checkout | |
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' | |
uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ubuntu-go-1.23.4-release-cache-${{ hashFiles('cli/go.sum') }} | |
restore-keys: | | |
ubuntu-go-1.23.4-release-cache-cli | |
- name: Set up Go | |
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: cli/go.mod | |
cache: false | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install GoReleaser | |
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser-pro | |
version: latest | |
install-only: true | |
- name: Run GoReleaser Dry-Run | |
if: startsWith(github.head_ref, 'release-please--branches--main--components') || github.event_name == 'push' | |
run: goreleaser release --snapshot --clean --skip=validate,publish,sign -f ./cli/.goreleaser.yaml | |
env: | |
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |