Build danser #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build danser | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Danser version' | |
type: string | |
required: true | |
draft: | |
description: 'Create draft release' | |
type: boolean | |
required: false | |
default: true | |
jobs: | |
build_windows: | |
name: Building windows version | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout master branch | |
uses: actions/checkout@v3 | |
- name: Install winlibs | |
uses: bwoodsend/setup-winlibs-action@v1 | |
- name: Install golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.4' | |
cache: true | |
- name: Build danser | |
run: | | |
version="${{ github.event.inputs.version }}" | |
./dist-win.sh $version | |
if [ ! -f "dist/artifacts/danser-${version// /-s}-win.zip" ]; then | |
echo "Danser failed to build" | |
exit 1 | |
fi | |
id: build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
if: ${{ !failure() && steps.build.conclusion != 'failure' }} | |
with: | |
name: danser | |
path: dist/artifacts/* | |
build_linux: | |
name: Building linux version | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout master branch | |
uses: actions/checkout@v3 | |
- name: Install needed packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install xorg-dev libgl1-mesa-dev libgtk-3-dev | |
- name: Install golang | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.4' | |
cache: true | |
- name: Build danser | |
run: | | |
version="${{ github.event.inputs.version }}" | |
chmod +x dist-linux.sh | |
./dist-linux.sh $version | |
if [ ! -f "dist/artifacts/danser-${version// /-s}-linux.zip" ]; then | |
echo "Danser failed to build" | |
exit 1 | |
fi | |
id: build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
if: ${{ !failure() && steps.build.conclusion != 'failure' }} | |
with: | |
name: danser | |
path: dist/artifacts/* | |
publish_release: | |
name: Publish draft release | |
if: ${{ !cancelled() && needs.build_windows.result == 'success' && needs.build_linux.result == 'success' && github.event.inputs.draft }} | |
needs: [build_windows, build_linux] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: danser | |
path: artifacts | |
- name: Create release | |
id: create_release | |
run: | | |
set -xe | |
shopt -s nullglob | |
version="${{ github.event.inputs.version }}" | |
NAME="${version// / snapshot }" | |
TAGNAME="${version// /-s}" | |
hub release create --draft $(for a in artifacts/*.{zip,tar.xz}; do echo -a $a; done) -m "$NAME" -t "master" "$TAGNAME" | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |