-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (71 loc) · 2.64 KB
/
Copy pathrelease.yml
File metadata and controls
81 lines (71 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Release pipeline. Triggered by v* tags:
#
# git tag -a v0.1.0 -m "v0.1.0" && git push origin v0.1.0
#
# Produces: GitHub release with archives + checksums, multi-arch images
# (amd64 + arm64) pushed to BOTH GHCR (ghcr.io/c3xdev/c3x) and Docker
# Hub (docker.io/$DOCKER_ORG/$DOCKER_REPOSITORY), Homebrew cask push to
# c3xdev/homebrew-tap, cosign keyless signatures on all images.
#
# Required repo secrets:
# HOMEBREW_RELEASE_TOKEN — PAT with push access to c3xdev/homebrew-tap
# DOCKER_USERNAME / DOCKER_PASSWORD — Docker Hub push credentials
# DOCKER_ORG / DOCKER_REPOSITORY — Docker Hub image coordinates
name: release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write # create GitHub releases
packages: write # push images to GHCR
id-token: write # cosign keyless OIDC signing
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # goreleaser changelog needs full history
- uses: actions/setup-go@v5
with:
go-version: '1.25'
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: GHCR login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Hub login
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Install cosign
uses: sigstore/cosign-installer@v3
- name: goreleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_RELEASE_TOKEN: ${{ secrets.HOMEBREW_RELEASE_TOKEN }}
# Docker Hub image coordinates (docker.io/$ORG/$REPO), consumed
# by the dockers_v2 image template in .goreleaser.yaml.
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
- name: Sign images (keyless)
env:
DOCKER_ORG: ${{ secrets.DOCKER_ORG }}
DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
run: |
ver="${GITHUB_REF_NAME#v}"
cosign sign --yes "ghcr.io/c3xdev/c3x:${ver}"
cosign sign --yes "ghcr.io/c3xdev/c3x:latest"
cosign sign --yes "docker.io/${DOCKER_ORG}/${DOCKER_REPOSITORY}:${ver}"
cosign sign --yes "docker.io/${DOCKER_ORG}/${DOCKER_REPOSITORY}:latest"