Fix publish workflow (#2)

* Add dotnet test workflow

* main -> master

* Try a different workflow

* Add working-directory

* use windows runner

* use env var

* Fix build and test order

* Specify configuration

* Specify sln instead of working dir

* Specify that DOTNET_SLN is an env var

* Add publish workflow

* Add env.DOTNET_SLN to publish workflow

* Add publish job

* Combine publish into one job

* Just create an artifact

* Remove unused nuget lines

* Add Publish job back

Co-authored-by: Aaron Reisman <areisman@epic.com>
This commit is contained in:
pixil98 2022-11-16 13:40:57 -06:00 committed by GitHub
parent 064801380b
commit 8a82c294a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,34 +15,57 @@ env:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
source-url: https://nuget.pkg.github.com/<owner>/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore dependencies
run: dotnet restore ${{ DOTNET_SLN }}
run: dotnet restore ${{ env.DOTNET_SLN }}
- name: Build
run: dotnet build --configuration ${{ env.DOTNET_CONFIGURATION }} --no-restore ${{ DOTNET_SLN }}
- name: Test
run: dotnet test --configuration ${{ env.DOTNET_CONFIGURATION }} --no-build --verbosity normal ${{ DOTNET_SLN }}
- name: Zip Artifact
run: zip -r Libation.${{ github.ref_name }}.zip ./Source/bin/${{ env.DOTNET_CONFIGURATION }}/*
run: dotnet build --configuration ${{ env.DOTNET_CONFIGURATION }} --no-restore ${{ env.DOTNET_SLN }}
- name: Publish Artifact
uses: actions/upload-artifact@v3
with:
name: Libation ${{ github.ref_name }}
path: Libation.${{ github.ref_name }}.zip
if-no-files-found: error
name: LibationZip
path: ./Source/bin/${{ env.DOTNET_CONFIGURATION }}/
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: LibationZip
path: ./Libation-${{ github.ref_name }}
- name: Zip Artifact
run: zip -r Libation.${{ github.ref_name }}.zip ./Libation-${{ github.ref_name }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Libation ${{ github.ref }}
body: <Put a body here>
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-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: Libation.${{ github.ref_name }}.zip
asset_name: Libation.${{ github.ref_name }}.zip
asset_content_type: application/zip