Skip to content

Commit

Permalink
fix: release pipeline 2
Browse files Browse the repository at this point in the history
  • Loading branch information
drgsn committed Dec 26, 2024
1 parent 05ba3e8 commit 772acfa
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 23 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,43 @@ name: Release

on:
push:
# Trigger this workflow only when you push a tag that starts with "v",
# e.g. "v1.0.0" or "v2.0.0".
tags:
- 'v*.*.*'
- 'v*'

# Add permissions needed for creating releases
permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
- name: Checkout
uses: actions/checkout@v4
with:
# We fetch all commits & tags so GoReleaser can properly read the tag version
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ make
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Run tests
run: go test -v ./...

- name: Run GoReleaser
# The official GoReleaser GitHub Action
uses: goreleaser/goreleaser-action@v4
with:
# By default, it will look for .goreleaser.yml in the repo root
distribution: goreleaser
version: latest
args: release
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CGO_ENABLED: 1
47 changes: 37 additions & 10 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@ version: 2

before:
hooks:
# If you have tests, uncomment:
- go test ./...
- echo "Starting GoReleaser..."

builds:
- id: filefusion
# If your main.go is in the root folder, use "." or "./".
main: ./cmd/filefusion/main.go
# The base output filename (GoReleaser adds .exe for Windows).
binary: filefusion
# Target OS/Arch combos:
goos:
- linux
- darwin
Expand All @@ -24,28 +20,59 @@ builds:
- CGO_ENABLED=1
flags:
- -tags=bash cpp csharp golang css html java php kotlin javascript ruby python swift typescript sql
# Add overrides for ARM64 cross-compilation
overrides:
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
# Skip Windows ARM64 as it's less commonly used
ignore:
- goos: windows
goarch: arm64

archives:
- id: filefusion-archive
# Name format for each archive
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
# Linux & macOS get tar.gz by default; Windows gets .zip
name_template: >-
{{ .ProjectName }}_{{ .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
format: zip
# Files to include in the archive
files:
- README*
- LICENSE*
allow_different_binary_count: true

# Publishes a GitHub release for the git tag you push (e.g., v0.0.2).
release:
prerelease: auto
draft: false
name_template: 'v{{ .Version }}'
header: |
## FileFusion {{ .Version }}
For full details, see the [documentation](https://github.com/drgsn/filefusion#readme).
footer: |
**Full Changelog**: https://github.com/drgsn/filefusion/compare/{{ .PreviousTag }}...{{ .Tag }}
# Generate checksums for the archives
checksum:
name_template: 'checksums.txt'
algorithm: sha256

# Add changelog configuration
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^ci:'
- Merge pull request
- Merge branch

snapshot:
name_template: '{{ incpatch .Version }}-next'

0 comments on commit 772acfa

Please sign in to comment.