Add files via upload #42
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: Deploy Windows Forms App | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x # 指定 .NET 6 版本 | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Publish Windows Forms App with ClickOnce without version | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
run: dotnet publish -c Release -r win-x64 --self-contained false /p:PublishSingleFile=true /p:ClickOnceDeploymentBuild=true /p:PublishProfile="./QuickIPchange/My Project/PublishProfiles/ClickOnceProfile.pubxml" | |
- name: Get the version Tag | |
if: startsWith(github.ref, 'refs/tags/') | |
id: vars | |
run: echo ${{ github.ref_name }} | |
- name: Publish Windows Forms App with ClickOnce with version | |
if: startsWith(github.ref, 'refs/tags/') | |
run: dotnet publish -c Release -r win-x64 --self-contained false /p:PublishSingleFile=true /p:ClickOnceDeploymentBuild=true /p:PublishProfile="./QuickIPchange/My Project/PublishProfiles/ClickOnceProfile.pubxml" /p:AssemblyVersion=${{ github.ref_name }} /p:Version=${{ github.ref_name }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: clickonce-artifact | |
path: ./QuickIPchange/bin/Release/net6.0-windows/win-x64/publish/QuickIPchange.exe | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ./QuickIPchange/bin/Release/net6.0-windows/win-x64/publish/QuickIPchange.exe | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |