Skip to content

publish

publish #32

Workflow file for this run

name: publish
env:
ProjectName: KeyAsio.Net
on:
create:
tags:
- "v*.*.*"
jobs:
build:
name: Build and Release
if: ${{ StartsWith(github.ref, 'refs/tags/') }}
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: '0'
submodules: 'recursive'
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: |
dotnet restore KeyAsio.Gui
- name: Secrets
if: ${{ success() }}
shell: pwsh
run: |
echo 'public partial class EmbeddedSentryConfiguration { private static readonly string __dsn ="${{ secrets.SENTRY_DSN }}"; }'>KeyAsio.Sentry/EmbeddedSentryConfiguration.Secret.cs
# dotnet publish KeyAsio.Gui --framework net8.0-windows --configuration Release --output ci-publish
- name: Publish
if: ${{ success() }}
run: |
echo ${{ github.ref }}
dotnet publish KeyAsio.Gui --no-restore --framework net8.0-windows --runtime win-x64 --self-contained --configuration Release --output ci-publish-win64
dotnet publish KeyAsio.Gui --no-restore --framework net8.0-windows --runtime win-x86 --self-contained --configuration Release --output ci-publish-win32
# echo '<project outputDir="." baseDir=".\ci-publish" xmlns="http://confuser.codeplex.com"><rule pattern="true" preset="maximum" inherit="false" /><module path="KeyAsio.Sentry.dll" /></project>'>confuse.crproj
# .\ConfuserEx\Confuser.CLI.exe confuse.crproj -n
# del .\ci-publish\KeyAsio.Sentry.pdb -Force
- name: Confuser
if: ${{ success() }}
shell: pwsh
run: |
echo '<project outputDir="." baseDir=".\ci-publish-win64" xmlns="http://confuser.codeplex.com"><rule pattern="true" preset="maximum" inherit="false" /><module path="KeyAsio.Sentry.dll" /></project>'>confuse64.crproj
echo '<project outputDir="." baseDir=".\ci-publish-win32" xmlns="http://confuser.codeplex.com"><rule pattern="true" preset="maximum" inherit="false" /><module path="KeyAsio.Sentry.dll" /></project>'>confuse32.crproj
mkdir ConfuserEx -Force
Invoke-WebRequest https://github.com/mkaring/ConfuserEx/releases/download/v1.6.0/ConfuserEx-CLI.zip -OutFile "ConfuserEx/cli.zip"
7z x "ConfuserEx/cli.zip" -oConfuserEx/
.\ConfuserEx\Confuser.CLI.exe confuse64.crproj -n
.\ConfuserEx\Confuser.CLI.exe confuse32.crproj -n
del .\ci-publish-win64\KeyAsio.Sentry.pdb -Force
del .\ci-publish-win32\KeyAsio.Sentry.pdb -Force
# .\KeyAsio.Gui\afterbuild.ps1 .\ci-publish\KeyAsio.Gui.exe
- name: Set dll path
if: ${{ success() }}
shell: pwsh
run: |
copy .\KeyAsio.Gui\DotNetDllPathPatcher.ps1 .\DotNetDllPathPatcher.ps1
.\KeyAsio.Gui\afterbuild.ps1 .\ci-publish-win64\KeyAsio.Gui.exe
.\KeyAsio.Gui\afterbuild.ps1 .\ci-publish-win32\KeyAsio.Gui.exe
- name: Get tag
uses: dawidd6/action-get-tag@v1
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }}
id: tag
# 7z a -mx9 -mfb=273 -ms -md=31 -myx=9 -mtm=- -mmt -mmtf -md=1536m -mmf=bt3 -mmc=10000 -mpb=0 -mlc=0 "./ci-pack/${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}.7z" "./ci-publish/*" -x!"${{ env.ProjectName }}" -r
- name: Pack via 7z
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }}
run: |
mkdir -p ./ci-pack/
7z a -mx9 -mfb=273 -ms -md=31 -myx=9 -mtm=- -mmt -mmtf -md=1536m -mmf=bt3 -mmc=10000 -mpb=0 -mlc=0 "./ci-pack/${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}-win64.7z" "./ci-publish-win64/*" -x!"${{ env.ProjectName }}" -r
7z a -mx9 -mfb=273 -ms -md=31 -myx=9 -mtm=- -mmt -mmtf -md=1536m -mmf=bt3 -mmc=10000 -mpb=0 -mlc=0 "./ci-pack/${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}-win32.7z" "./ci-publish-win32/*" -x!"${{ env.ProjectName }}" -r
# ./ci-pack/${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}.7z
- name: Create a new GitHub release if a new tag is pushed
uses: softprops/action-gh-release@v1
if: ${{ success() && startsWith(github.ref, 'refs/tags/') }}
env:
GITHUB_TOKEN: ${{secrets.RELEASE_TOKEN}}
with:
body: |
[Forum page](https://osu.ppy.sh/community/forums/topics/1602658)
## Release notes
1. Place holder
name: ${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}
prerelease: true
draft: false
files: |
./ci-pack/${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}-win64.7z
./ci-pack/${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}-win32.7z
# ### Installation
# .NET 8.0 Desktop Runtime is required for the smallest asset.
# For the other two assets with "-win32" and "-win64" postfix, you don't need to install anything more.