Skip to content

Release Builds

Release Builds #6

Workflow file for this run

name: Release Builds
on:
release:
types: [created]
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.22]
os: [linux, windows, darwin]
arch: [amd64, arm64]
include:
- os: windows
extension: .exe
- os: linux
extension: ''
- os: darwin
extension: ''
name: Build for ${{ matrix.os }}/${{ matrix.arch }}
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 10
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: |
go build -o mhmods-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
- name: Compress binary
run: |
FILES="mhmods-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}"
[ -f LICENSE ] && FILES="$FILES LICENSE"
[ -f README.md ] && FILES="$FILES README.md"
tar -czvf mhmods-${{ matrix.os }}-${{ matrix.arch }}.tar.gz $FILES
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: mhmods-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_name: mhmods-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip