forked from ColdThunder11/AdnmbBackup-gui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d1f2a2
commit 485db52
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Build and Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] # 监听 PR 的关闭事件 | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
if: github.event.pull_request.merged == true #检查关闭的 PR 是否被合并,只有被合并时才继续执行 | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v1 | ||
|
||
- name: Cache NuGet packages | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: Setup MSBuild Path | ||
uses: warrenbuckley/Setup-MSBuild@v1 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | ||
|
||
- name: Setup NuGet | ||
uses: NuGet/[email protected] | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | ||
|
||
- name: Restore NuGet Packages | ||
run: nuget restore AdnmbBackup-gui/AdnmbBackup-gui.sln | ||
|
||
- name: Build | ||
run: msbuild AdnmbBackup-gui/AdnmbBackup-gui.sln /p:Configuration=Release /p:DebugSymbols=false /p:DebugType=None | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./AdnmbBackup-gui/bin/Release/AdnmbBackup-gui.exe | ||
asset_name: AdnmbBackup-gui.exe | ||
asset_content_type: application/octet-stream |