-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.09 KB
/
Copy pathrelease.yml
File metadata and controls
51 lines (42 loc) · 1.09 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
name: Create release
permissions:
contents: write
on:
workflow_dispatch:
inputs:
version:
description: "The release version"
required: true
type: string
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Get Go version
id: version
run: awk '{if($1 == "go") print "version=" $2}' go.mod >> "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ${{steps.version.outputs.version}}
- name: Tag version
if: github.event_name == 'workflow_dispatch'
run: |
git fetch --force --tags
git tag --force ${{ github.event.inputs.version }}
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.PAT }}