update workflow #120
Workflow file for this run
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: "Build and publish" | |
on: | |
push: | |
tags: | |
- 'v*' | |
env: | |
INSTALLER_PATH: 'Totoro.Installer\Totoro.Installer.wixproj' | |
MAIN_PROJECT_PATH: 'Totoro.WinUI\Totoro.WinUI.csproj' | |
FFMPEG_PATH: 'Totoro.Installer\FFmpeg' | |
PUBLISH_FOLDER: 'Totoro.WinUI\bin\publish' | |
jobs: | |
deploy: | |
name: 'Build and deploy' | |
runs-on: 'windows-latest' | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v2 | |
- name: 'Install dotnet' | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0' | |
- name: 'Add msbuild to PATH' | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: 'Get version' | |
id: version | |
uses: battila7/get-version-action@v2 | |
- name: 'Build Project' | |
run: dotnet publish ${{ env.MAIN_PROJECT_PATH }} --self-contained -c Release -r win10-x64 -o ${{ env.PUBLISH_FOLDER }} /property:BuildVersion=${{ steps.version.outputs.version-without-v }} | |
- name: 'Copy FFMPEG' | |
run: xcopy ${{ env.FFMPEG_PATH }} ${{ env.PUBLISH_FOLDER }}\FFmpeg\ /s /e /h | |
- name: 'Remove Trash' | |
run: rd /q /s ${{ env.PUBLISH_FOLDER }}\gd-gb\*, ${{ env.PUBLISH_FOLDER }}\mi-NZ\*, ${{ env.PUBLISH_FOLDER }}\ug-CN\* | |
- name: Update App Settings | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: '${{ env.PUBLISH_FOLDER }}\appsettings.json' | |
env: | |
ClientId: ${{ secrets.MAL_CLIENT_ID }} | |
ClientIdAniList: ${{ secrets.ANILIST_CLIENT_ID }} | |
ClientIdSimkl: ${{ secrets.SIMKL_CLIENT_ID }} | |
- name: 'Build Installer' | |
run: msbuild ${{ env.INSTALLER_PATH }} /property:Configuration=Release /property:BuildVersion=${{ steps.version.outputs.version-without-v }} | |
- name: 'Create Release' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.version.outputs.version-without-v }} | |
release_name: ${{ steps.version.outputs.version-without-v }} | |
- name: 'Add MSI to release' | |
uses: csexton/release-asset-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
pattern: Totoro.Installer/bin/Release/en-us/Totoro-Release.msi | |
release-url: ${{ steps.create_release.outputs.upload_url }} |