mirror of
https://github.com/jpillora/chisel
synced 2026-06-08 15:07:02 +00:00
d56938d7a2
and undo some AI changes 😔
93 lines
2.6 KiB
YAML
93 lines
2.6 KiB
YAML
name: CI
|
|
on:
|
|
pull_request: {}
|
|
push: {}
|
|
permissions: write-all
|
|
jobs:
|
|
# ================
|
|
# BUILD AND TEST JOB
|
|
# ================
|
|
test:
|
|
name: Build & Test
|
|
strategy:
|
|
matrix:
|
|
go-version: ["stable"]
|
|
platform: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
check-latest: true
|
|
- name: Build
|
|
run: go build -v -o /dev/null .
|
|
- name: Test
|
|
run: go test -v ./...
|
|
# ================
|
|
# RELEASE BINARIES (on push "v*" tag)
|
|
# ================
|
|
release_binaries:
|
|
name: Release Binaries
|
|
needs: test
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- name: goreleaser
|
|
if: success()
|
|
uses: docker://goreleaser/goreleaser:latest
|
|
env:
|
|
GITHUB_USER: ${{ github.repository_owner }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GOTOOLCHAIN: auto
|
|
with:
|
|
args: release --config .github/goreleaser.yml
|
|
# ================
|
|
# RELEASE DOCKER IMAGES (on push "v*" tag)
|
|
# ================
|
|
release_docker:
|
|
name: Release Docker Images
|
|
needs: test
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v5
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: jpillora
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: jpillora/chisel
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: .github/Dockerfile
|
|
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/386,linux/arm/v7,linux/arm/v6
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|