-
Notifications
You must be signed in to change notification settings - Fork 3
112 lines (97 loc) · 2.93 KB
/
release.yml
File metadata and controls
112 lines (97 loc) · 2.93 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Publish Tagged Release
on:
push:
# run only against tags
tags:
- '*'
permissions:
contents: write
# packages: write
# issues: write
jobs:
printJob:
name: Show Release Context
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Show git details
run: |
git fetch origin main:main
echo ---
git log --oneline -4
echo --
echo gitBranch:
git rev-parse --abbrev-ref HEAD
echo ---
echo gitSHA:
git rev-parse --short HEAD
echo ---
echo tag --contains:
git tag --contains
echo ---
echo branch --contains:
git branch --all --contains ${{ github.ref_name }}
echo ---
echo local branches:
git branch -v
echo ---
echo remote branches:
git branch -v -r
echo ---
echo "git rev-list origin/main...HEAD | wc -l"
export N=$(git rev-list origin/main...HEAD | wc -l)
echo ">>$N<<"
echo ---
echo "tag --contains origin/main":
git tag --contains origin/main
echo ---
git tag --contains origin/main | grep "${{ github.ref_name }}"
goreleaser:
name: Package and Publish Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Fetch origin/main for comparisons
run: git fetch origin main:main
- name: Set Variables
run: |
echo "GO_VERSION=$(cat .tool-versions | grep golang | awk '{print $2}')" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install Task
uses: arduino/setup-task@v2
- name: Install dependencies
run: |
go install github.com/restechnica/semverbot/cmd/sbot@latest
go install github.com/git-chglog/git-chglog/cmd/git-chglog@v0.15.1
- name: Generate release notes
run: |
task preview-release-notes
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean --release-notes RELEASE_NOTES.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}