rebase
This commit is contained in:
120
.github/workflows/test-and-build.yml
vendored
Normal file
120
.github/workflows/test-and-build.yml
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
name: Test and Build Project
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_type:
|
||||
description: "Build type: version or pre"
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- version
|
||||
- pre
|
||||
version_number:
|
||||
description: "Version number"
|
||||
required: true
|
||||
type: string
|
||||
jobs:
|
||||
build:
|
||||
runs-on: self-hosted
|
||||
permissions:
|
||||
contents: write
|
||||
actions: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: v0.0.2-dev
|
||||
fetch-depth: 0
|
||||
- name: Test code
|
||||
run: |
|
||||
echo "Testing code"
|
||||
- name: Clean build
|
||||
run: |
|
||||
echo "Cleaning build"
|
||||
rm -rf MeowEmbeddedMusicServer-*
|
||||
- name: Build version
|
||||
if: ${{ github.event.inputs.build_type == 'version' }}
|
||||
run: |
|
||||
echo "Building version ${{ github.event.inputs.version_number }}"
|
||||
go mod tidy
|
||||
echo "Build linux i386 binary"
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Linux-i386 . && upx -9 MeowEmbeddedMusicServer-Linux-i386
|
||||
echo "Build linux amd64 binary"
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Linux-amd64 . && upx -9 MeowEmbeddedMusicServer-Linux-amd64
|
||||
echo "Build linux arm64 binary"
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Linux-arm64 . && upx -9 MeowEmbeddedMusicServer-Linux-arm64
|
||||
echo "Build windows i386 binary"
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Windows-i386.exe . && upx -9 MeowEmbeddedMusicServer-Windows-i386.exe
|
||||
echo "Build windows amd64 binary"
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Windows-amd64.exe . && upx -9 MeowEmbeddedMusicServer-Windows-amd64.exe
|
||||
echo "Build windows arm64 binary"
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Windows-arm64.exe .
|
||||
echo "Build darwin amd64 binary"
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Darwin-amd64 .
|
||||
echo "Build darwin arm64 binary"
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Darwin-arm64 .
|
||||
- name: Build pre-release
|
||||
if: ${{ github.event.inputs.build_type == 'pre' }}
|
||||
run: |
|
||||
echo "Building pre-release ${{ github.event.inputs.version_number }}"
|
||||
go mod tidy
|
||||
echo "Build linux i386 binary"
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Linux-i386 . && upx -9 MeowEmbeddedMusicServer-Linux-i386
|
||||
echo "Build linux amd64 binary"
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Linux-amd64 . && upx -9 MeowEmbeddedMusicServer-Linux-amd64
|
||||
echo "Build linux arm64 binary"
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Linux-arm64 . && upx -9 MeowEmbeddedMusicServer-Linux-arm64
|
||||
echo "Build windows i386 binary"
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Windows-i386.exe . && upx -9 MeowEmbeddedMusicServer-Windows-i386.exe
|
||||
echo "Build windows amd64 binary"
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Windows-amd64.exe . && upx -9 MeowEmbeddedMusicServer-Windows-amd64.exe
|
||||
echo "Build windows arm64 binary"
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Windows-arm64.exe .
|
||||
echo "Build darwin amd64 binary"
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Darwin-amd64 .
|
||||
echo "Build darwin arm64 binary"
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -trimpath -o MeowEmbeddedMusicServer-Darwin-arm64 .
|
||||
- name: Get latest tag
|
||||
id: get_latest_tag
|
||||
run: |
|
||||
git fetch --tags
|
||||
LATEST_TAG=$(git tag --sort=-refname | head -n 1)
|
||||
echo "Latest tag found: $LATEST_TAG"
|
||||
echo "previous_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
|
||||
- name: Upload binaries
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.version_number }}
|
||||
name: ${{ github.event.inputs.version_number }}
|
||||
body: |
|
||||
### Build Information
|
||||
- Branch: v0.0.2-dev
|
||||
- Commit: ${{ github.sha }}
|
||||
|
||||
### Binaries
|
||||
- Linux i386
|
||||
- Linux amd64
|
||||
- Linux arm64
|
||||
- Windows i386
|
||||
- Windows amd64
|
||||
- Windows arm64
|
||||
- macOS amd64
|
||||
- macOS arm64
|
||||
|
||||
**Full Changelog**: https://github.com/OmniX-Space/MeowBox-Core/compare/${{ steps.get_latest_tag.outputs.previous_tag }}...${{ github.sha }}
|
||||
files: |
|
||||
MeowEmbeddedMusicServer-Linux-i386
|
||||
MeowEmbeddedMusicServer-Linux-amd64
|
||||
MeowEmbeddedMusicServer-Linux-arm64
|
||||
MeowEmbeddedMusicServer-Windows-i386.exe
|
||||
MeowEmbeddedMusicServer-Windows-amd64.exe
|
||||
MeowEmbeddedMusicServer-Windows-arm64.exe
|
||||
MeowEmbeddedMusicServer-Darwin-amd64
|
||||
MeowEmbeddedMusicServer-Darwin-arm64
|
||||
prerelease: ${{ github.event.inputs.build_type == 'pre' }}
|
||||
make_latest: ${{ github.event.inputs.build_type != 'pre' }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
|
||||
continue-on-error: true
|
||||
Reference in New Issue
Block a user