Skip to content

Commit 4864c75

Browse files
committed
chore(ci): release workflow
1 parent aea0607 commit 4864c75

4 files changed

Lines changed: 130 additions & 0 deletions

File tree

.github/workflows/release.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Generate Next Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write # needed to create the GitHub release and upload binary artifacts
8+
pull-requests: write # needed for "included in release" comments from semantic-release bot
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-latest
14+
outputs:
15+
new_release_published: ${{ steps.release.outputs.new_release_published }}
16+
new_release_git_tag: ${{ steps.release.outputs.new_release_git_tag }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4.0.0
20+
with:
21+
fetch-depth: 0
22+
- name: Set up Go
23+
uses: actions/setup-go@v5.0.0
24+
with:
25+
go-version-file: go.mod
26+
- name: Release
27+
id: release
28+
uses: cycjimmy/semantic-release-action@v4.2.2
29+
with:
30+
semantic_version: 24.0.0
31+
extra_plugins: |
32+
conventional-changelog-conventionalcommits@8.0.0
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
publish:
37+
name: Publish
38+
needs: release
39+
if: needs.release.outputs.new_release_published == 'true'
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Check out code
43+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
44+
with:
45+
ref: "${{ needs.release.outputs.new_release_git_tag }}"
46+
47+
- name: Set up Go
48+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
49+
with:
50+
go-version-file: './go.mod'
51+
id: go
52+
53+
- name: Run GoReleaser
54+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6
55+
with:
56+
version: latest
57+
args: release --clean
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

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

.goreleaser.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This is an example goreleaser.yaml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
version: 2
4+
5+
before:
6+
hooks:
7+
- go mod tidy
8+
builds:
9+
- main: ./main.go
10+
env:
11+
- CGO_ENABLED=0
12+
binary: equinix
13+
ldflags:
14+
- -s -w -X github.com/equinix/cli/internal/version.Version={{.Version}}
15+
16+
goos:
17+
- freebsd
18+
- linux
19+
- windows
20+
- darwin
21+
goarch:
22+
- amd64
23+
- arm64
24+
25+
archives:
26+
- formats:
27+
- 'binary'
28+
name_template: "equinix-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
29+
checksum:
30+
name_template: "equinix_{{ .Version }}_checksums.txt"
31+
release:
32+
mode: "keep-existing"
33+
34+
homebrew_casks:
35+
- name: myproject
36+
homepage: "https://docs.equinix.com/"
37+
description: "Official Equinix CLI"
38+
license: "MIT"
39+
commit_msg_template: "Brew formula update for {{ .Binary }} version {{ .Tag }}"
40+
repository:
41+
owner: equinix
42+
name: homebrew-tap

.releaserc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"ci": false,
6+
"plugins": [
7+
[
8+
"@semantic-release/commit-analyzer",
9+
{
10+
"preset": "conventionalcommits"
11+
}
12+
],
13+
[
14+
"@semantic-release/release-notes-generator",
15+
{
16+
"preset": "conventionalcommits"
17+
}
18+
],
19+
[
20+
"@semantic-release/github",
21+
{
22+
"successComment": "This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:",
23+
"labels": false,
24+
"releasedLabels": false
25+
}
26+
]
27+
]
28+
}

0 commit comments

Comments
 (0)