diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..cc3734c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,58 @@ +name: publish +env: + ProjectName: genshin-fps-unlock +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 unlockfps_gui + + - name: Publish + if: ${{ success() }} + run: | + echo ${{ github.ref }} + dotnet publish unlockfps_gui --no-restore --runtime win-x64 --configuration Release --output ci-publish-win64 + + - name: Get tag + uses: dawidd6/action-get-tag@v1 + if: ${{ success() && startsWith(github.ref, 'refs/tags/') }} + id: tag + + - 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 + + - 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.GITHUB_TOKEN}} + with: + name: ${{ steps.tag.outputs.tag }} + prerelease: true + draft: false + files: | + ./ci-pack/${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}-win64.7z \ No newline at end of file