update Go 1.24 and latest linter rules; fix linter errors (#266) #69
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: Release | |
on: | |
push: | |
branches: | |
- master | |
- main | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
paths-ignore: | |
- 'docs/**' | |
- 'deploy/**' | |
- 'examples/**' | |
- 'test/**' | |
- '*.md' | |
- '*.yaml' | |
jobs: | |
build: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.24' | |
cache: true | |
cache-dependency-path: go.sum | |
- name: Build Release Binaries | |
env: | |
GOPROXY: https://proxy.golang.org | |
CGO_ENABLED: 0 | |
run: | | |
make release | |
- name: Debug Directory Contents | |
run: | | |
echo "Current working directory:" | |
pwd | |
echo "Listing contents of .bin/ recursively:" | |
find .bin/ -type f -ls || echo "No files found in .bin/" | |
echo "Directory structure:" | |
ls -laR .bin/ || echo "Directory .bin/ is empty or does not exist" | |
echo "Testing glob expansion:" | |
ls .bin/* || echo "Glob .bin/* found no files" | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pumba-binaries | |
path: .bin/* | |
retention-days: 7 | |
compression-level: 6 | |
include-hidden-files: true | |
create-release: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
name: Create GitHub Release | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: pumba-binaries | |
path: ${{ github.workspace }}/.bin/ | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
name: Release ${{ github.ref_name }} | |
body: "Automated release for ${{ github.ref_name }}" | |
generateReleaseNotes: true | |
prerelease: true | |
artifacts: ${{ github.workspace }}/.bin/* | |
allowUpdates: false | |
commit: ${{ github.sha }} | |
draft: false | |
removeArtifacts: false | |
replacesArtifacts: true | |
push-docker: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
name: Push Docker Image | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Tag Name | |
id: get_tag | |
run: echo "git_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Get Short SHA | |
id: short_sha | |
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Set Up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker-container | |
platforms: linux/amd64,linux/arm64 | |
- name: Set Up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_ACCOUNT }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.DOCKER_ORG }}/pumba | |
tags: | | |
type=semver,pattern={{version}} | |
type=raw,value=latest | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v6 | |
with: | |
file: docker/Dockerfile | |
context: . | |
build-args: | | |
BRANCH=${{ github.ref_name }} | |
COMMIT=${{ steps.short_sha.outputs.sha }} | |
SKIP_TESTS=true | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
provenance: true | |
sbom: true |