Skip to content

Build project

Build project #13

Workflow file for this run

name: Build project
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
prepareBuild:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
steps:
- name: Create Release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release v${{ github.ref }}
draft: false
prerelease: true
buildForAllSupportedPlatforms:
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
needs: prepareBuild
strategy:
fail-fast: false
matrix:
projectPath:
- Blocktest
- DedicatedServer
targetPlatform:
- linux-x64 # Build a macOS standalone (Intel 64-bit).
- win-x86 # Build a Windows 32-bit standalone.
- win-x64 # Build a Windows 64-bit standalone.
- osx-x64 # Build a Linux 64-bit standalone.
dotnet:
- '7.x'
- '6.x'
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
${{ matrix.dotnet }}
3.1.x
- name: Build
run: dotnet publish ${{ matrix.projectPath }} --configuration Release --runtime ${{ matrix.targetPlatform }} -p:PublishReadyToRun=false -p:TieredCompilation=false -p:PublishSingleFile=true -p:Version=$(git describe --tags --abbrev=0) --self-contained false --output ./Build/${{ matrix.targetPlatform }}
- name: Zip build
run: |
pushd Build/${{ matrix.targetPlatform }}
zip -r ../../Blocktest-${{ matrix.targetPlatform }}-${{ matrix.dotnet }}.zip .
popd
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1 #TODO: Update to a maintained action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepareBuild.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Blocktest-${{ matrix.targetPlatform }}-${{ matrix.dotnet }}.zip
asset_name: ${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ matrix.dotnet }}.zip
asset_content_type: application/zip