Skip to content

Commit eda2def

Browse files
committed
Switch to reusable GoReleaser workflow
1 parent d5c12ec commit eda2def

File tree

1 file changed

+8
-49
lines changed

1 file changed

+8
-49
lines changed

.github/workflows/release.yaml

+8-49
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,17 @@
1-
name: Release packaging
1+
name: Release
22

33
on:
44
workflow_dispatch:
5+
pull_request:
56
push:
6-
branches:
7-
- main
8-
tags:
9-
- 'v[0-9]+.*'
107

11-
permissions:
12-
contents: write
8+
permissions: {}
139

1410
jobs:
1511
release:
16-
runs-on: ubuntu-latest
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v3
20-
with:
21-
# Required by GoReleaser
22-
fetch-depth: 0
12+
uses: hansmi/ghactions-goreleaser-workflow/.github/workflows/release.yaml@stable
13+
permissions:
14+
contents: write
15+
packages: write
2316

24-
- name: Go setup
25-
uses: actions/setup-go@v3
26-
with:
27-
go-version: 1
28-
29-
- name: Set variables
30-
id: vars
31-
env:
32-
EVENT_NAME: ${{ github.event_name }}
33-
REF: ${{ github.ref }}
34-
run: |
35-
if [[ "$EVENT_NAME" = push && "$REF" = refs/tags/v[0-9]*.* ]]; then
36-
args=()
37-
else
38-
args=( --skip-publish )
39-
fi
40-
echo "goreleaser_args=${args[*]}" >> $GITHUB_OUTPUT
41-
42-
- name: Run GoReleaser
43-
uses: goreleaser/goreleaser-action@v3
44-
with:
45-
distribution: goreleaser
46-
version: latest
47-
args: release --rm-dist ${{ steps.vars.outputs.goreleaser_args }}
48-
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
51-
- name: Upload assets
52-
uses: actions/upload-artifact@v3
53-
with:
54-
name: prometheus-lvm-exporter-${{ hashFiles('dist/**') }}
55-
path: dist/**
56-
if-no-files-found: error
57-
58-
# vim: set sw=2 sts=2 et : -->
17+
# vim: set sw=2 sts=2 et :

0 commit comments

Comments
 (0)