feat[ci]: Create Release & Upload Release Asset #27
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: AssetStudioBuild | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
createRelease: | |
description: 'Create a new GitHub Release?' | |
required: true | |
default: 'false' | |
releaseTitle: | |
description: 'version name' | |
required: true | |
default: 'v0.16.48' | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: microsoft/[email protected] | |
- name: Download FBX SDK | |
run: | | |
md fbx | |
cd fbx | |
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_vs2019_win.exe" -OutFile "fbxsdk.exe" | |
Start-Process -FilePath "fbxsdk.exe" /S -Wait | |
Invoke-WebRequest "https://damassets.autodesk.net/content/dam/autodesk/www/adn/fbx/2020-2-1/fbx202021_fbxsdk_vs2019_pdbs.exe" -OutFile "fbxpdb.exe" | |
Start-Process -FilePath "fbxpdb.exe" /S -Wait | |
cd .. | |
- name: Nuget Restore | |
run: nuget restore | |
- name: Build .Net472 | |
run: msbuild /p:Configuration=Release /p:TargetFramework=net472 /verbosity:minimal | |
- name: Build .Net5 | |
run: msbuild /t:AssetStudioGUI:publish /p:Configuration=Release /p:TargetFramework=net5.0-windows /p:SelfContained=false /verbosity:minimal | |
- name: Build .Net6 | |
run: msbuild /t:AssetStudioGUI:publish /p:Configuration=Release /p:TargetFramework=net6.0-windows /p:SelfContained=false /verbosity:minimal | |
- name: Upload .Net472 Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: AssetStudio.net472 | |
path: AssetStudioGUI/bin/Release/net472 | |
- name: Upload .Net5 Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: AssetStudio.net5 | |
path: AssetStudioGUI/bin/Release/net5.0-windows/publish | |
- name: Upload .Net6 Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: AssetStudio.net6 | |
path: AssetStudioGUI/bin/Release/net6.0-windows/publish | |
- name: Create Release | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.createRelease == 'true' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKENFORCI }} | |
with: | |
tag_name: ${{ github.event.inputs.releaseTitle }} | |
release_name: Release ${{ github.event.inputs.releaseTitle }} | |
body: Description of the release. | |
draft: false | |
prerelease: false | |
- name: Create Zip (.Net472) | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.createRelease == 'true' | |
run: Compress-Archive -Path ./AssetStudioGUI/bin/Release/net472/* -DestinationPath ./AssetStudioGUI/bin/Release/net472/AssetStudio.net472.zip | |
shell: powershell | |
- name: Upload Release Asset (.Net472) | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.createRelease == 'true' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKENFORCI }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./AssetStudioGUI/bin/Release/net472/AssetStudio.net472.zip | |
asset_name: AssetStudio.net472.zip | |
asset_content_type: application/zip | |
- name: Create Zip (.Net5) | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.createRelease == 'true' | |
run: Compress-Archive -Path ./AssetStudioGUI/bin/Release/net5.0-windows/publish/* -DestinationPath ./AssetStudioGUI/bin/Release/net5.0-windows/publish/AssetStudio.net5.zip | |
shell: powershell | |
- name: Upload Release Asset (.Net5) | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.createRelease == 'true' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKENFORCI }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./AssetStudioGUI/bin/Release/net5.0-windows/publish/AssetStudio.net5.zip | |
asset_name: AssetStudio.net5.zip | |
asset_content_type: application/zip | |
- name: Create Zip (.Net6) | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.createRelease == 'true' | |
run: Compress-Archive -Path ./AssetStudioGUI/bin/Release/net6.0-windows/publish/* -DestinationPath ./AssetStudioGUI/bin/Release/net6.0-windows/publish/AssetStudio.net6.zip | |
shell: powershell | |
- name: Upload Release Asset (.Net6) | |
if: github.event_name == 'workflow_dispatch' && github.event.inputs.createRelease == 'true' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKENFORCI }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./AssetStudioGUI/bin/Release/net6.0-windows/publish/AssetStudio.net6.zip | |
asset_name: AssetStudio.net6.zip | |
asset_content_type: application/zip |