Skip to content

Commit

Permalink
ci: add build and release CI using goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
jantari committed Jan 25, 2024
1 parent d79b512 commit a3e3da6
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build

# Run when tags are pushed or manually
on:
workflow_dispatch:
push:
tags:
- '*'

# contents: write is required to publish artifacts
# https://goreleaser.com/ci/actions/#token-permissions
permissions:
contents: write

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'

- name: Go lint
run: |
go install golang.org/x/lint/golint@latest
golint .
- name: Staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck .
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
project_name: SecretLinks

builds:
- id: linux
ldflags:
- -s -w # do not include debug symbols in executables
- -X 'main.version={{.Version}}' # set version information in-program
env: [CGO_ENABLED=0]
goos: [linux]
goarch: [amd64]
goamd64: [v1]

archives:
- format: zip

changelog:
filters:
exclude:
- '^(?i)ci:'
- '^(?i)readme:'

release:
name_template: "Version {{.Version}}"
prerelease: auto
draft: true

0 comments on commit a3e3da6

Please sign in to comment.