Skip to content

Commit

Permalink
Add release binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
lhaig committed Nov 14, 2024
1 parent a3cc2d6 commit 2ef82d9
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 1 deletion.
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release Go Application

on:
push:
tags:
- 'v*'

permissions:
contents: write
packages: write

jobs:
goreleaser:
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: '1.23'
cache: true

- name: Run tests
run: go test -v ./...

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
install-only: true

- name: Build and Release
run: goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binaries
path: dist/*
45 changes: 45 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# .goreleaser.yaml
project_name: pdsadmin

before:
hooks:
- go mod tidy

builds:
- id: pdsadmin
binary: pdsadmin # This will create executables named 'pdsadmin' (or pdsadmin.exe on Windows)
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
- Merge pull request
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/lhaig/pdsadmin

go 1.22.0
go 1.23

require (
github.com/fatih/color v1.16.0
Expand Down

0 comments on commit 2ef82d9

Please sign in to comment.