Build for all platforms
This commit is contained in:
65
.github/workflows/build.yml
vendored
Normal file
65
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
name: Build and Release with xgo
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install xgo
|
||||
run: |
|
||||
go install src.techknowlogick.com/xgo@latest
|
||||
|
||||
- name: Cross-compile with xgo
|
||||
run: |
|
||||
xgo --targets=*/* .
|
||||
|
||||
- name: Prepare artifacts
|
||||
run: |
|
||||
mkdir artifacts
|
||||
mv zurg-* artifacts/
|
||||
|
||||
- name: Upload artifacts to workflow
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: compiled-binaries
|
||||
path: artifacts/
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: compiled-binaries
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- 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: ./zurg-*
|
||||
asset_name: zurg-${{ github.run_number }}-${{ github.sha }}
|
||||
asset_content_type: application/octet-stream
|
||||
Reference in New Issue
Block a user