Merge pull request #4 from Robocnop/main #31
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: ElevatorBC Build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
REFERENCES_URL: https://misaka-zerotwo.github.io/SL-References/Master.zip | |
EXILED_REFERENCES: ${{ github.workspace }}/References | |
jobs: | |
build: | |
if: github.event_name == 'pull_request' || github.event_name == 'push' | |
runs-on: windows-latest | |
steps: | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v3 | |
- uses: actions/[email protected] | |
- name: Restore Packages | |
run: nuget restore | |
- name: Get Build References | |
shell: pwsh | |
run: | | |
Invoke-WebRequest -Uri ${{ env.REFERENCES_URL }} -OutFile ${{ github.workspace }}/Dev.zip | |
Expand-Archive -Path Dev.zip -DestinationPath ${{ env.EXILED_REFERENCES }} | |
- name: Setup MSBuild.exe | |
uses: microsoft/Setup-MSBuild@v1 | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | |
- name: Build | |
run: | | |
msbuild ElevatorBC.csproj -t:rebuild -property:Configuration=Release -property:EXILED_REFERENCES="${{ env.EXILED_REFERENCES }}" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ElevatorBC | |
path: "bin/Release/ElevatorBC.dll" | |
release: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: windows-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ElevatorBC | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
body: | | |
Changes in this Release | |
- First Change | |
- Second Change | |
draft: true | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.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: .\ElevatorBC.dll | |
asset_name: ElevatorBC.dll | |
asset_content_type: application/octet-stream |