Skip to content

Commit cef3536

Browse files
authored
2-feature-create-go-releases (#5)
* feat: Creating Go releases
1 parent d08c313 commit cef3536

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

.github/workflows/go-releaser.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# .github/workflows/release.yml
2+
name: goreleaser
3+
4+
on:
5+
push:
6+
# run only against tags
7+
tags:
8+
- "*"
9+
10+
permissions:
11+
contents: write
12+
# packages: write # write if you push Docker images to GitHub
13+
# issues: write # write if you use milestone closing capability
14+
15+
jobs:
16+
goreleaser:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- name: Set up Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: stable
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Run GoReleaser
30+
uses: goreleaser/goreleaser-action@v5
31+
with:
32+
# either 'goreleaser' (default) or 'goreleaser-pro'
33+
distribution: goreleaser
34+
# 'latest', 'nightly', or a semver
35+
version: "~> v1"
36+
args: release --clean
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
dist/

.goreleaser.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
4+
# The lines below are called `modelines`. See `:help modeline`
5+
# Feel free to remove those if you don't want/need to use them.
6+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
7+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
8+
9+
version: 1
10+
11+
before:
12+
hooks:
13+
# You may remove this if you don't use go modules.
14+
- go mod tidy
15+
# you may remove this if you don't need go generate
16+
- go generate ./...
17+
18+
builds:
19+
- env:
20+
- CGO_ENABLED=0
21+
goos:
22+
- linux
23+
- windows
24+
- darwin
25+
26+
archives:
27+
- format: tar.gz
28+
# this name template makes the OS and Arch compatible with the results of `uname`.
29+
name_template: >-
30+
{{ .ProjectName }}_
31+
{{- title .Os }}_
32+
{{- if eq .Arch "amd64" }}x86_64
33+
{{- else if eq .Arch "386" }}i386
34+
{{- else }}{{ .Arch }}{{ end }}
35+
{{- if .Arm }}v{{ .Arm }}{{ end }}
36+
# use zip for windows archives
37+
format_overrides:
38+
- goos: windows
39+
format: zip
40+
41+
changelog:
42+
sort: asc
43+
filters:
44+
exclude:
45+
- "^docs:"
46+
- "^test:"
47+
48+
release:
49+
mode: replace
50+
replace_existing_artifacts: true
51+
# Header for the release body.
52+
#
53+
# Templates: allowed
54+
header: |
55+
## GitHub Foundations CLI ({{ .Date }})
56+
57+
The latest release of the GitHub Foundations CLI.
58+
59+
# Footer for the release body.
60+
#
61+
# Templates: allowed
62+
footer: |
63+
## Thanks
64+
65+
Changes for tag: {{ .Tag }}!

0 commit comments

Comments
 (0)