-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
99 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Build and Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release | ||
|
||
- name: Publish | ||
run: dotnet publish --configuration Release --output ./output | ||
|
||
- name: Copy assets folder to output directory | ||
run: cp -r ./assets ./output/assets | ||
|
||
- name: Archive output | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: linux-binaries | ||
path: ./output | ||
|
||
- name: Create GitHub Release | ||
if: github.ref == 'refs/heads/main' | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ github.run_number }} | ||
release_name: Release v${{ github.run_number }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Linux Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./output | ||
asset_name: linux-output.zip | ||
asset_content_type: application/zip | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: '8.0.x' | ||
|
||
- name: Restore dependencies | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build --configuration Release | ||
|
||
- name: Publish | ||
run: dotnet publish --configuration Release --output ./output | ||
|
||
- name: Copy assets folder to output directory | ||
run: Copy-Item -Recurse -Path ./assets -Destination ./output/assets | ||
|
||
- name: Archive output | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: windows-binaries | ||
path: ./output | ||
|
||
- name: Upload Windows Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.build-linux.outputs.create_release.outputs.upload_url }} | ||
asset_path: ./output | ||
asset_name: windows-output.zip | ||
asset_content_type: application/zip |