This commit is contained in:
Sora 2023-04-16 08:15:20 +08:00 committed by GitHub
parent 0f38d4d33e
commit be21ea48a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 47 additions and 24 deletions

View File

@ -1,44 +1,67 @@
name: Build and Test name: Build ChangeTimestamp
on: on:
push: push:
branches: branches: [ main ]
- main
pull_request: pull_request:
branches: branches: [ main ]
- main
jobs: jobs:
build: build:
strategy:
matrix:
configuration: [Release]
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- name: Checkout code - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
path: ChangeTimestamp # 修改为实际的解决方案所在目录
# Install the .NET Framework version 4.0
- name: Use .NET Framework version 4.0 - name: Use .NET Framework version 4.0
uses: microsoft/setup-msbuild@v1.0.2 uses: microsoft/setup-msbuild@v1.0.2
with: with:
dotnet-version: '4.0' dotnet-version: '4.0'
- name: Restore NuGet packages # Install NuGet packages
working-directory: ChangeTimestamp # 修改为实际的解决方案所在目录 - name: Install NuGet Packages
run: nuget restore ChangeTimestamp.sln run: nuget restore ChangeTimestamp.sln
# Build solution
- name: Build solution - name: Build solution
working-directory: ChangeTimestamp # 修改为实际的解决方案所在目录 run: msbuild.exe ChangeTimestamp.sln /t:Build /p:Configuration=${{ matrix.configuration }}
run: msbuild.exe ChangeTimestamp.sln /t:Build /p:Configuration=Release
- name: Run tests # Delete-tag-and-release
working-directory: ChangeTimestamp/TestProject # 修改为实际的测试项目所在目录 - name: Delete-tag-and-release
run: vstest.console.exe YourTestProject.dll /Logger:trx uses: dev-drprasad/delete-tag-and-release@v0.2.0
- name: Archive artifacts
uses: actions/upload-artifact@v2
with: with:
name: Artifacts delete_release: true # default: false
path: | tag_name: AutoBuild # tag name to delete
ChangeTimestamp/bin/Release/* env:
ChangeTimestamp/TestProject/TestResults/*.trx GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create Release
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: AutoBuild
release_name: AutoBuild
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: true
# Upload Release Asset
- name: Upload Release Asset
id: 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: ./ChangeTimestamp/bin/Release/ChangeTimestamp.exe
asset_name: ChangeTimestamp.exe
asset_content_type: application/octet-stream