feat(metadata): add image properties, image-read, image-write, image-… #617
This file contains hidden or 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 | |
| jobs: | |
| test: | |
| name: Lint and test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Golang with cache | |
| uses: magnetikonline/action-golang-cache@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| install-mode: goinstall | |
| version: v2.4.0 | |
| - name: Test | |
| run: go test ./... | |
| release-please: | |
| name: Run Release Please | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| tag_name: ${{ steps.release.outputs.tag_name }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Release Please | |
| uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.CR_PAT }} | |
| release-type: simple | |
| changelog-path: CHANGELOG.md | |
| build-binaries: | |
| name: Build binaries | |
| runs-on: ubuntu-latest | |
| needs: [release-please] | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| strategy: | |
| matrix: | |
| os: [linux, windows, darwin] | |
| arch: [amd64, arm64, 386] | |
| exclude: | |
| - os: darwin | |
| arch: 386 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Golang with cache | |
| uses: magnetikonline/action-golang-cache@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| run: | | |
| set -e | |
| CGO_ENABLED=0 GOOS="${{ matrix.os }}" GOARCH="${{ matrix.arch }}" go build -o out/ ./cmd/... | |
| [[ "${{ matrix.os }}" = "windows" ]] && suff=".exe" | |
| cd out/ | |
| for p in *; do | |
| mv "$p" "${p%.*}-${{ matrix.os }}-${{ matrix.arch }}-${{ needs.release-please.outputs.tag_name }}$suff" | |
| done | |
| cd - | |
| - name: Upload | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.CR_PAT }} | |
| file: out/* | |
| file_glob: true | |
| tag: ${{ needs.release-please.outputs.tag_name }} | |
| build-docker: | |
| name: Build, tag, and publish Docker image | |
| runs-on: ubuntu-latest | |
| needs: [release-please] | |
| if: ${{ needs.release-please.outputs.release_created }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Login into DockerHub | |
| run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
| - name: Login into GitHub Container Registry | |
| run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Build and Push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7 | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}:${{ needs.release-please.outputs.tag_name }} | |
| ghcr.io/${{ github.repository }}:latest | |
| ${{ github.repository }}:${{ needs.release-please.outputs.tag_name }} | |
| ${{ github.repository }}:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |