-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8211ce3
commit 85cb223
Showing
2 changed files
with
87 additions
and
35 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
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 ${{ matrix.projectPath }} 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: | ||
- 8.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 |