From 170ebf28b71a70ecfa0e4a4b6b10ad920498fbcf Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Tue, 21 Nov 2023 15:40:46 +0100 Subject: [PATCH] Fix build --- .github/workflows/build.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 134f533..8a754cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build and Release with xgo +name: Build and Release on: push @@ -20,8 +20,8 @@ jobs: with: xgo_version: latest go_version: 1.21 - dest: build - prefix: myapp + dest: artifacts + prefix: zurg targets: windows/amd64,linux/amd64,linux/arm64,darwin/arm64 v: true x: false @@ -30,21 +30,18 @@ jobs: buildmode: default trimpath: true - - name: Prepare artifacts - run: | - mkdir artifacts - mv github.com/debridmediamanager.com/zurg/cmd/zurg-* artifacts/ - - # New step for compressing artifacts - name: Compress artifacts run: | - tar -czvf artifacts.tar.gz -C artifacts . + mkdir -p compressed_artifacts + for platform in windows/amd64 linux/amd64 linux/arm64 darwin/arm64; do + tar -czvf "compressed_artifacts/zurg-$platform-${{ github.run_number }}-${{ github.sha }}.tar.gz" -C artifacts ./zurg-$platform* + done - name: Upload artifacts to workflow uses: actions/upload-artifact@v3 with: name: compiled-binaries - path: artifacts.tar.gz + path: compressed_artifacts/*.tar.gz release: needs: build @@ -66,13 +63,16 @@ jobs: draft: false prerelease: false - # Ensure the asset_path matches the compressed file name - name: Upload binaries to release - uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./artifacts.tar.gz - asset_name: zurg-${{ github.run_number }}-${{ github.sha }}.tar.gz - asset_content_type: application/gzip + run: | + for platform in windows/amd64 linux/amd64 linux/arm64 darwin/arm64; do + asset_path="./compressed_artifacts/zurg-$platform-${{ github.run_number }}-${{ github.sha }}.tar.gz" + if [[ -f "$asset_path" ]]; then + echo "Uploading $asset_path" + gh release upload ${{ github.ref }} "$asset_path" --c ${{ secrets.GITHUB_TOKEN }} + else + echo "File not found: $asset_path" + fi + done