Build fixes

This commit is contained in:
Ben Sarmiento
2023-11-21 16:51:19 +01:00
parent a846c0c0cc
commit 3141c0cb3e
3 changed files with 42 additions and 15 deletions

View File

@@ -9,7 +9,15 @@ jobs:
build:
name: Build
runs-on: self-hosted
permissions:
contents: read
packages: write
steps:
- name: Set version
id: version
run: echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/})"
- name: Set up Go
uses: actions/setup-go@v4
with:
@@ -35,7 +43,7 @@ jobs:
-X 'version.BuiltAt=$(date +%Y-%m-%dT%H:%M:%S)'
-X 'version.GoVersion=$(go version)'
-X 'version.GitCommit=$(git rev-parse HEAD)'
-X 'version.Version=${{ github.ref }}'
-X 'version.Version=${{ steps.version.outputs.version }}'
buildmode: default
trimpath: true
@@ -43,7 +51,7 @@ jobs:
run: |
mkdir -p compressed_artifacts
for platform in windows-amd64.exe linux-amd64 linux-arm64 darwin-arm64; do
zip -r "compressed_artifacts/zurg-$platform-${{ github.ref }}.zip" "artifacts/zurg-$platform"
zip -r "compressed_artifacts/zurg-${{ steps.version.outputs.version }}-$platform.zip" "artifacts/zurg-$platform"
done
- name: Upload artifacts to workflow
@@ -57,6 +65,10 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- name: Set version
id: version
run: echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/})"
- name: Download artifacts
uses: actions/download-artifact@v3
with:
@@ -68,8 +80,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
@@ -78,10 +90,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for platform in windows/amd64 linux/amd64 linux/arm64 darwin/arm64; do
asset_path="./compressed_artifacts/zurg-$platform-${{ github.ref }}.zip"
asset_path="./compressed_artifacts/zurg-$platform-${{ steps.version.outputs.version }}.zip"
if [[ -f "$asset_path" ]]; then
echo "Uploading $asset_path"
gh release upload ${{ github.ref }} "$asset_path" --c ${{ secrets.GITHUB_TOKEN }}
gh release upload ${{ steps.version.outputs.version }} "$asset_path" --c ${{ secrets.GITHUB_TOKEN }}
else
echo "File not found: $asset_path"
fi