From 6a37c31d96bfefa4bc707b1b9020f901b96af3aa Mon Sep 17 00:00:00 2001 From: Dragos Niculescu Date: Thu, 26 Dec 2024 02:14:04 +0200 Subject: [PATCH] feat: fixed typo fix: release pipeline (#32) --- .github/workflows/release.yml | 62 +++++++++++++++------------- .goreleaser.yml | 78 +++++++++++++---------------------- README.md | 4 +- 3 files changed, 65 insertions(+), 79 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82843d7..fbbf605 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.goreleaser.yml b/.goreleaser.yml index 4db8f8c..f7f42b5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -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 diff --git a/README.md b/README.md index 8a9cd9e..948ac26 100644 --- a/README.md +++ b/README.md @@ -360,7 +360,7 @@ documents: - Be specific with patterns - Test patterns before processing -## ❗ Common Issues and Solutions +## ❗ Issues and Solutions ### "no files found matching pattern" @@ -387,5 +387,5 @@ documents: ---
-Made with ❤️ by the DrGos team +Made with ❤️ by the DrGos