forked from wind-c/comqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (65 loc) · 1.95 KB
/
Copy pathrelease.yaml
File metadata and controls
75 lines (65 loc) · 1.95 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
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag to release (e.g. v2.7.0). Required for manual runs."
required: true
type: string
permissions:
contents: write
packages: write
jobs:
goreleaser:
name: GoReleaser
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
cache: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push tag (manual dispatch only)
if: github.event_name == 'workflow_dispatch'
env:
TAG: ${{ inputs.tag }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
git push origin "$TAG"
# GHCR image names must be lowercase. github.repository_owner is
# already lowercase for users/orgs, but we lowercase defensively.
- name: Compute lowercase image owner
id: owner
run: echo "value=${OWNER,,}" >> "$GITHUB_OUTPUT"
env:
OWNER: ${{ github.repository_owner }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IMAGE_OWNER: ${{ steps.owner.outputs.value }}