From b60c640e14d99195cff85b576360ac433769e67a Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sun, 3 Aug 2025 12:54:15 +0300 Subject: Github workflows hopefully works now? --- .github/workflows/release.yml | 126 +++++++++--------------------------------- 1 file changed, 26 insertions(+), 100 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd87d19..797e0f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,110 +1,36 @@ -name: Release +name: Build Go binaries on github release on: - push: - tags: - - 'v*' + release: + types: [created] # only runs when you manually click "Create release" matching a tag + +permissions: + contents: write + packages: write jobs: - build: - name: Build release binaries + publish-binaries: + runs-on: ubuntu-latest strategy: - fail-fast: false matrix: - include: - - target: linux/amd64 - ext: tar.gz - runs_on: ubuntu-latest - - - target: linux/arm64 - ext: tar.gz - runs_on: ubuntu-latest - - - target: linux/386 - ext: tar.gz - runs_on: ubuntu-latest - - - target: linux/arm - ext: tar.gz - runs_on: ubuntu-latest - - - target: windows/amd64 - ext: zip - runs_on: windows-latest - - - target: windows/386 - ext: zip - runs_on: windows-latest - - - target: windows/arm64 - ext: zip - runs_on: windows-latest - - - target: darwin/amd64 - ext: tar.gz - runs_on: macos-latest - - - target: darwin/arm64 - ext: tar.gz - runs_on: macos-latest - - runs-on: ${{ matrix.runs_on }} + goos: [linux, darwin, windows] + goarch: [386, amd64, arm64] + exclude: + - goarch: "386" # darwin/386 not supported + goos: darwin + - goarch: arm64 # windows/arm64 well supported now, but you can exclude if you like + goos: darwin steps: - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: stable - - - name: Package on Windows (PowerShell) - if: runner.os == 'Windows' - shell: pwsh - run: | - $GOARCH = "${{ matrix.target.split('/')[1] }}" - $GOOS = "windows" - $BIN = "eko.exe" - $DEST = "dist/eko-${GOARCH}-$GOOS.zip" - - # Maybe: Compress-Archive -Path $BIN or use Get-ChildItem - Compress-Archive -LiteralPath $BIN -DestinationPath $DEST - - # Compute SHA256 checksum – via built-in command or external tool if missing - if (Get-Command shasum -ErrorAction SilentlyContinue) { - shasum -a 256 $DEST | Out-File "$DEST.sha256" -Encoding ascii - } else { - # fallback: use PowerShell's Get-FileHash - $hash = (Get-FileHash $DEST -Algorithm SHA256).Hash - "$hash $(Split-Path $DEST -Leaf)" | Out-File "$DEST.sha256" - } - - - name: Build binary - if: runner.os != 'Windows' - shell: bash - run: | - TARGET="${{ matrix.target }}" - GOOS=$(echo "$TARGET" | cut -d'/' -f1) - GOARCH=$(echo "$TARGET" | cut -d'/' -f2) - BIN=eko - EXT="" - if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi - - mkdir -p dist - env GOOS=$GOOS GOARCH=$GOARCH go build -o $BIN$EXT ./cmd/client - - ARCHIVE=dist/${BIN}-${GOARCH}-${GOOS}.${{ matrix.ext }} - - if [ "${{ matrix.ext }}" = "zip" ]; then - zip -j $ARCHIVE $BIN$EXT - else - tar -czf $ARCHIVE $BIN$EXT - fi - - shasum -a 256 $ARCHIVE > $ARCHIVE.sha256 - - - name: Upload release artifacts - uses: softprops/action-gh-release@v2 + - uses: wangyoucao577/go-release-action@v1 with: - token: ${{ secrets.EKO_RELEASE_TOKEN }} - tag_name: ${{ github.ref_name }} - files: dist/* + github_token: ${{ secrets.EKO_RELEASE_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + binary_name: eko + project_path: ./cmd/client + sha256sum: true + md5sum: false + overwrite: true + retry: 5 -- cgit v1.3.1