2020-04-09 12:01:40 +01:00
|
|
|
name: Release
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
2021-01-22 10:36:52 +00:00
|
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
2020-04-09 12:01:40 +01:00
|
|
|
steps:
|
2022-06-23 13:50:50 +01:00
|
|
|
- name: Checkout Source
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-04-09 12:01:40 +01:00
|
|
|
- name: Unshallow
|
|
|
|
run: git fetch --prune --unshallow
|
|
|
|
- name: Set up Go
|
2022-03-14 13:10:28 +00:00
|
|
|
uses: actions/setup-go@v3
|
2020-04-09 12:01:40 +01:00
|
|
|
with:
|
2022-11-08 08:54:40 +00:00
|
|
|
go-version: '1.19.3'
|
2022-02-22 20:33:42 +00:00
|
|
|
- name: Install Cosign
|
2022-06-23 13:50:50 +01:00
|
|
|
uses: sigstore/cosign-installer@v2
|
2022-02-22 20:33:42 +00:00
|
|
|
with:
|
2022-03-21 15:53:22 +00:00
|
|
|
cosign-release: 'v1.6.0'
|
2022-02-22 20:33:42 +00:00
|
|
|
- name: Store Cosign private key in a file
|
|
|
|
run: 'echo "$COSIGN_KEY" > /tmp/cosign.key'
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
|
|
|
|
- name: Set up QEMU
|
2022-05-09 11:02:57 +01:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2022-02-22 20:33:42 +00:00
|
|
|
- name: Set up Docker Buildx
|
2022-05-09 11:02:57 +01:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-02-22 20:33:42 +00:00
|
|
|
- name: Login to DockerHub
|
2022-05-09 11:02:57 +01:00
|
|
|
uses: docker/login-action@v2
|
2022-02-22 20:33:42 +00:00
|
|
|
with:
|
|
|
|
username: ${{secrets.DOCKER_USERNAME}}
|
|
|
|
password: ${{secrets.DOCKER_PASSWORD}}
|
2021-06-21 09:50:44 +01:00
|
|
|
- name: Generate SBOM
|
2021-10-15 09:57:09 +01:00
|
|
|
uses: CycloneDX/gh-gomod-generate-sbom@v1
|
2021-06-21 09:50:44 +01:00
|
|
|
with:
|
2021-10-15 09:57:09 +01:00
|
|
|
version: v1
|
|
|
|
args: mod -licenses -json -output bom.json
|
2022-02-22 20:33:42 +00:00
|
|
|
- name: Docker meta
|
2022-05-09 11:02:57 +01:00
|
|
|
uses: docker/metadata-action@v4
|
2022-02-22 20:33:42 +00:00
|
|
|
id: meta
|
|
|
|
with:
|
|
|
|
images: securego/gosec
|
|
|
|
flavor: |
|
|
|
|
latest=true
|
|
|
|
tags: |
|
|
|
|
type=sha,format=long
|
|
|
|
type=semver,pattern={{version}}
|
2020-04-09 12:01:40 +01:00
|
|
|
- name: Release Binaries
|
2023-01-02 16:35:12 +00:00
|
|
|
uses: goreleaser/goreleaser-action@v4
|
2020-04-09 12:01:40 +01:00
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
args: release --rm-dist
|
|
|
|
env:
|
2022-02-22 20:33:42 +00:00
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
|
|
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
|
2020-04-09 12:01:40 +01:00
|
|
|
- name: Release Docker Image
|
2022-05-09 11:02:57 +01:00
|
|
|
uses: docker/build-push-action@v3
|
2020-04-09 12:01:40 +01:00
|
|
|
with:
|
2022-02-22 20:33:42 +00:00
|
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
|
|
tags: ${{steps.meta.outputs.tags}}
|
|
|
|
labels: ${{steps.meta.outputs.labels}}
|
|
|
|
push: true
|
2022-08-08 08:32:58 +01:00
|
|
|
build-args: GO_VERSION=1.19
|
2022-02-22 20:33:42 +00:00
|
|
|
- name: Sign Docker Image
|
|
|
|
run: cosign sign -key /tmp/cosign.key ${TAGS}
|
|
|
|
env:
|
|
|
|
TAGS: ${{steps.meta.outputs.tags}}
|
|
|
|
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
|