Build flow

This commit is contained in:
Ben Sarmiento
2023-11-21 16:06:59 +01:00
parent 4a053f42a0
commit c22206800c
2 changed files with 8 additions and 45 deletions

View File

@@ -1,6 +1,9 @@
name: Build and Release name: Build and Release
on: push on:
push:
tags:
- '*'
jobs: jobs:
build: build:
@@ -34,15 +37,15 @@ jobs:
- name: Compress artifacts - name: Compress artifacts
run: | run: |
mkdir -p compressed_artifacts mkdir -p compressed_artifacts
for platform in windows/amd64 linux/amd64 linux/arm64 darwin/arm64; do for platform in windows-amd64.exe linux-amd64 linux-arm64 darwin-arm64; do
tar -czvf "compressed_artifacts/zurg-$platform-${{ github.run_number }}-${{ github.sha }}.tar.gz" -C artifacts ./zurg-$platform* zip -r "compressed_artifacts/zurg-$platform-${{ github.ref }}.zip" "artifacts/zurg-$platform"
done 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: compressed_artifacts/*.tar.gz path: compressed_artifacts/*.zip
release: release:
needs: build needs: build
@@ -69,7 +72,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
for platform in windows/amd64 linux/amd64 linux/arm64 darwin/arm64; do 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" asset_path="./compressed_artifacts/zurg-$platform-${{ github.ref }}.zip"
if [[ -f "$asset_path" ]]; then if [[ -f "$asset_path" ]]; then
echo "Uploading $asset_path" echo "Uploading $asset_path"
gh release upload ${{ github.ref }} "$asset_path" --c ${{ secrets.GITHUB_TOKEN }} gh release upload ${{ github.ref }} "$asset_path" --c ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,40 +0,0 @@
name: build
on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]
jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest]
go-version: [1.21.3]
name: Build
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
docker pull techknowlogick/xgo:latest
go install src.techknowlogick.com/xgo@latest
sudo apt install upx
- name: Build
run: |
bash build.sh dev
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: zurg
path: dist