Skip to content

Commit

Permalink
Create publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Milkitic committed Feb 2, 2024
1 parent fbd34e6 commit de08ed8
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit de08ed8

Please sign in to comment.