Bump docker/build-push-action from 5 to 6 #74
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: CI | |
on: push | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: python3 -m unittest | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [windows, linux, darwin] | |
goarch: [amd64, arm64] | |
goarm: [''] | |
include: | |
- goos: linux | |
goarch: arm | |
goarm: 6 | |
- goos: linux | |
goarch: arm | |
goarm: 7 | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
GOARM: ${{ matrix.goarm }} | |
CGO_ENABLED: 0 # static binary | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.0 | |
- run: make dist | |
- id: vars | |
run: echo "distpath=$(make distpath)" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.vars.outputs.distpath }} | |
path: ${{ steps.vars.outputs.distpath }} | |
- run: sha256sum ${{ steps.vars.outputs.distpath }} > ${{ steps.vars.outputs.distpath }}.sha256 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.vars.outputs.distpath }}.sha256 | |
path: ${{ steps.vars.outputs.distpath }}.sha256 | |
containerise: | |
runs-on: ubuntu-latest | |
needs: [test, build] # do not build an image if tests failed | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- run: | | |
mkdir dist | |
mv artifacts/*/*.linux-*.tar.gz dist/ | |
- run: python3 artifact_docker_reorg.py docker/ dist/ | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
username: gebn | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- id: vars | |
run: echo "tag=$(make tag)" >> $GITHUB_OUTPUT | |
- uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7 | |
tags: gebn/bmc_exporter:${{ steps.vars.outputs.tag }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [test, build] | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
prerelease: ${{ contains(github.ref, '-') }} | |
files: | | |
artifacts/*/* |