-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: release pipeline (#32)
- Loading branch information
Showing
3 changed files
with
65 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,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*.*.*' | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
# Add permissions needed for creating releases | ||
permissions: | ||
contents: write | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
# We fetch all commits & tags so GoReleaser can properly read the tag version | ||
fetch-depth: 0 | ||
release: | ||
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.21' | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
|
||
- 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 | ||
version: latest | ||
args: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install cross-compilation tools | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y \ | ||
gcc g++ make \ | ||
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ | ||
gcc-mingw-w64 g++-mingw-w64 \ | ||
mingw-w64 | ||
echo "Installing tools completed" | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CGO_ENABLED: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,30 @@ | ||
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 | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
# Disable CGO if not needed: | ||
env: | ||
- CGO_ENABLED=0 | ||
|
||
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 | ||
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 }}" | ||
|
||
# Generate checksums for the archives | ||
checksum: | ||
name_template: "checksums.txt" | ||
algorithm: sha256 | ||
- id: filefusion | ||
main: ./cmd/filefusion/main.go | ||
binary: filefusion | ||
goos: | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
env: | ||
- CGO_ENABLED=1 | ||
flags: | ||
- -tags=bash cpp csharp golang css html java php kotlin javascript ruby python swift typescript sql | ||
overrides: | ||
- goos: linux | ||
goarch: arm64 | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=aarch64-linux-gnu-gcc | ||
- CXX=aarch64-linux-gnu-g++ | ||
- goos: windows | ||
goarch: amd64 | ||
env: | ||
- CGO_ENABLED=1 | ||
- CC=x86_64-w64-mingw32-gcc | ||
- CXX=x86_64-w64-mingw32-g++ | ||
ignore: | ||
- goos: windows | ||
goarch: arm64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters