Upgrade goreleaser to v2 (#348) #206
Workflow file for this run
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: Raito CLI - Release | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
contents: write | |
jobs: | |
releaser: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
check-latest: true | |
cache: false | |
- name: Run GoReleaser | |
id: goreleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GORELEASER_CURRENT_TAG: ${{github.ref_name}} | |
GITHUB_TOKEN: ${{ secrets.CI_SECRETS_TOKEN }} | |
- id: goreleaser_meta_parser | |
env: | |
goreleaser_meta: ${{ steps.goreleaser.outputs.metadata }} | |
run: | | |
version=$( echo $goreleaser_meta | jq -r '.version' ) | |
commit=$( echo $goreleaser_meta | jq -r '.commit' ) | |
date=$( echo $goreleaser_meta | jq -r '.date' ) | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "commit=$commit" >> $GITHUB_OUTPUT | |
echo "date=$date" >> $GITHUB_OUTPUT | |
echo "For debug purpose:" | |
echo "version=$version" | |
echo "commit=$commit" | |
echo "date=$date" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.CI_SECRETS_TOKEN_USER }} | |
password: ${{ secrets.CI_SECRETS_TOKEN }} | |
- name: Docker meta for deploy | |
id: meta-deploy | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/raito-io/raito-cli | |
flavor: latest=auto | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
labels: | | |
org.opencontainers.image.description=RAITO CLI | |
org.opencontainers.image.licenses=Apache-2.0 | |
org.opencontainers.image.vendor=Raito | |
org.opencontainers.image.documentation=https://docs.raito.io/ | |
org.opencontainers.image.source=https://github.com/raito-io/cli | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
VERSION=${{ steps.goreleaser_meta_parser.outputs.version }} | |
COMMIT_DATE=${{ steps.goreleaser_meta_parser.outputs.date }} | |
context: . | |
target: deploy | |
push: true | |
platforms: linux/amd64,linux/arm64,linux/386 | |
tags: ${{ steps.meta-deploy.outputs.tags }} | |
labels: ${{ steps.meta-deploy.outputs.labels }} | |
provenance: false | |
- name: Docker meta for amazon | |
id: meta-amazon | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/raito-io/raito-cli | |
flavor: | | |
latest=auto | |
suffix=-amazon,onlatest=true | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
labels: | | |
org.opencontainers.image.description=RAITO CLI | |
org.opencontainers.image.licenses=Apache-2.0 | |
org.opencontainers.image.vendor=Raito | |
org.opencontainers.image.documentation=https://docs.raito.io/ | |
org.opencontainers.image.source=https://github.com/raito-io/cli | |
- name: Build and push amazon | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
VERSION=${{ steps.goreleaser_meta_parser.outputs.version }} | |
COMMIT_DATE=${{ steps.goreleaser_meta_parser.outputs.date }} | |
context: . | |
target: amazonlinux | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta-amazon.outputs.tags }} | |
labels: ${{ steps.meta-amazon.outputs.labels }} | |
provenance: false |