Fix build

This commit is contained in:
Ben Sarmiento
2023-11-21 15:40:46 +01:00
parent dd6742a16f
commit 170ebf28b7

View File

@@ -1,4 +1,4 @@
name: Build and Release with xgo name: Build and Release
on: push on: push
@@ -20,8 +20,8 @@ jobs:
with: with:
xgo_version: latest xgo_version: latest
go_version: 1.21 go_version: 1.21
dest: build dest: artifacts
prefix: myapp prefix: zurg
targets: windows/amd64,linux/amd64,linux/arm64,darwin/arm64 targets: windows/amd64,linux/amd64,linux/arm64,darwin/arm64
v: true v: true
x: false x: false
@@ -30,21 +30,18 @@ jobs:
buildmode: default buildmode: default
trimpath: true 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 - name: Compress artifacts
run: | 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 - name: Upload artifacts to workflow
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: compiled-binaries name: compiled-binaries
path: artifacts.tar.gz path: compressed_artifacts/*.tar.gz
release: release:
needs: build needs: build
@@ -66,13 +63,16 @@ jobs:
draft: false draft: false
prerelease: false prerelease: false
# Ensure the asset_path matches the compressed file name
- name: Upload binaries to release - name: Upload binaries to release
uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: run: |
upload_url: ${{ steps.create_release.outputs.upload_url }} for platform in windows/amd64 linux/amd64 linux/arm64 darwin/arm64; do
asset_path: ./artifacts.tar.gz asset_path="./compressed_artifacts/zurg-$platform-${{ github.run_number }}-${{ github.sha }}.tar.gz"
asset_name: zurg-${{ github.run_number }}-${{ github.sha }}.tar.gz if [[ -f "$asset_path" ]]; then
asset_content_type: application/gzip echo "Uploading $asset_path"
gh release upload ${{ github.ref }} "$asset_path" --c ${{ secrets.GITHUB_TOKEN }}
else
echo "File not found: $asset_path"
fi
done