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: add goreleaser settings #49

Merged
merged 7 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
39 changes: 39 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
# @see https://github.com/actions/virtual-environments
name: Release
on:
push:
tags:
- "v*"
concurrency: ${{ github.workflow }}
jobs:
release:
name: Release
supercaracal marked this conversation as resolved.
Show resolved Hide resolved
if: github.repository == 'livesense-inc/fanlin'
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
project_name: fanlin

# https://goreleaser.com/customization/build/
# https://go.dev/doc/install/source#environment
builds:
- env:
- CGO_ENABLED=1
flags:
- -trimpath
supercaracal marked this conversation as resolved.
Show resolved Hide resolved
- -tags=timetzdata
ldflags:
- -s -w
goos:
- linux
goarch:
- amd64

# https://goreleaser.com/customization/archive/
archives:
- name_template: '{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}-v{{ . }}{{ end }}'
format: binary
replacements:
amd64: x86_64