Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: upgrade goreleaser and use tagpr #23

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .github/workflows/goreleaser.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: tag-and-release

on:
push:
branches:
- master
jobs:
tagpr:
runs-on: ubuntu-latest
outputs:
tagpr-tag: ${{ steps.run-tagpr.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- id: run-tagpr
name: Run tagpr
uses: Songmu/tagpr@v1
goreleaser:
needs: tagpr
if: needs.tagpr.outputs.tagpr-tag != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "latest"
args: release --clean
env:
# need to access other repository for brew-tap
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
93 changes: 49 additions & 44 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,73 @@
version: 2

before:
hooks:
# you may remove this if you don't use vgo
- go mod download
- go mod tidy
# you may remove this if you don't need go generate
#- go generate ./...

builds:
-
main: ./cmd/nrseg
- id: nrseg-darwin
ldflags:
- -s -w -X main.Version={{.Version}} -X main.Revision={{.ShortCommit}}
env:
- CGO_ENABLED=0
goos:
- darwin
goarch:
- amd64
- arm64
main: ./cmd/nrseg/main.go
- id: nrseg-linux
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
main: ./cmd/nrseg/main.go
- id: nrseg-windows
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- amd64
main: ./cmd/nrseg/main.go

archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- format: 'tar.gz'
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}'
files:
- CHANGELOG.md
- LICENSE.txt
- README.md
checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
brews:
-
# Name template of the recipe
# Default to project name
name: nrseg
- "^docs:"
- "^test:"

# Github repository to push the tap to.
tap:
brews:
- name: nrseg
url_template: "https://github.com/budougumi0617/nrseg/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
repository:
owner: budougumi0617
name: homebrew-tap

# Template for the url which is determined by the given Token (github or gitlab)
# Default for github is "https://github.com/<repo_owner>/<repo_name>/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
# Default for gitlab is "https://gitlab.com/<repo_owner>/<repo_name>/uploads/{{ .ArtifactUploadHash }}/{{ .ArtifactName }}"
url_template: "https://github.com/budougumi0617/nrseg/releases/download/{{ .Tag }}/{{ .ArtifactName }}"

# Git author used to commit to the repository.
# Defaults are shown.
token: "{{ .Env.GITHUB_TOKEN }}"
commit_author:
name: budougumi0617
email: [email protected]

# Your app's homepage.
# Default is empty.
name: "github-actions[bot]"
email: "github-actions[bot]@users.noreply.github.com"
homepage: "https://github.com/budougumi0617/nrseg"

# Your app's description.
# Default is empty.
description: "Insert function segments into any function/method for Newrelic APM."

# So you can `brew test` your formula.
# Default is empty.
license: "MIT"
install: |
bin.install "nrseg"
test: |
system "#{bin}/nrseg -h"
# Custom install script for brew.
# Default is 'bin.install "program"'.
install: |
bin.install "nrseg"
Empty file added CHANGELOG.md
Empty file.
Loading