diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 530c9d4..6e7b2b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,12 @@ # .github/workflows/release.yml on: - push: - branches: - - release + release: + types: [created] + +env: + PROJECT_NAME: Needlework.Net + ASSEMBLY_NAME: NeedleworkDotNet jobs: build: @@ -20,25 +23,13 @@ jobs: fetch-depth: 0 ref: release - name: Build - run: dotnet build Needlework.Net -c Release + run: dotnet build ${{env.PROJECT_NAME}} -c Release - name: Publish - run: dotnet publish Needlework.Net -c Release -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false -o publish -r win-x64 --self-contained=false - - name: Get Version - id: version - shell: powershell - run: | - $xml=[xml](Get-Content .\Needlework.Net\Needlework.Net.csproj) - $ver=($xml.Project.PropertyGroup).AssemblyVersion - $ver="VERSION=$ver" - $ver=$ver -replace '\s','' - echo $ver >> $env:GITHUB_OUTPUT - - name: Zip Files - run: 7z a -tzip NeedleworkDotNet-win-x64.zip ./Publish/* README.md LICENSE - - name: Release + run: dotnet publish ${{env.PROJECT_NAME}} -c Release -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=None -p:DebugSymbols=false -o publish -r win-x64 --self-contained=false + - name: Zip files + run: 7z a -tzip ${{env.ASSEMBLY_NAME}}-win-x64.zip ./Publish/* README.md LICENSE + - name: Upload to release uses: softprops/action-gh-release@v1 + if: ${{startsWith(github.ref, 'refs/tags/') }} with: - name: "Needlework.Net v${{ steps.version.outputs.VERSION }}" - prerelease: false - tag_name: "${{ steps.version.outputs.VERSION }}" - files: | - NeedleworkDotNet-win-x64.zip \ No newline at end of file + files: ${{env.ASSEMBLY_NAME}}-win-x64.zip \ No newline at end of file