Skip to content

Commit 46aef16

Browse files
authored
Merge pull request #5 from anpho/workflow
Workflow
2 parents 8ea9d8c + 4b7742a commit 46aef16

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

.github/workflows/build.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: build
5+
6+
on:
7+
pull_request:
8+
branches: [ "main" ]
9+
10+
jobs:
11+
build:
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: 8.0.x
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
- name: Build
23+
run: dotnet build --no-restore --configuration Release
24+
- name: Test
25+
run: dotnet test --no-build --verbosity normal

.github/workflows/pack.yml .github/workflows/release.yml

+11-27
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ name: build and release
66
on:
77
push:
88
branches: [ "main" ]
9-
pull_request:
10-
branches: [ "main" ]
9+
tags:
10+
- 'v*'
11+
1112

1213
jobs:
1314
build:
@@ -25,34 +26,17 @@ jobs:
2526
run: dotnet build --no-restore --configuration Release -o release_package
2627
- name: Test
2728
run: dotnet test --no-build --verbosity normal
28-
- name: Package as zip
29+
- name: Pack to zip
2930
run: |
30-
compress-archive -Path release_package\* -DestinationPath rmdup_${{github.sha}}.zip -CompressionLevel Fastest
31-
- name : Upload artifact
32-
uses: actions/upload-artifact@v4
33-
with:
34-
name: rmdup_${{github.sha}}.zip
35-
path: rmdup_${{github.sha}}.zip
36-
37-
31+
compress-archive -Path release_package\* -DestinationPath rmdup.zip -CompressionLevel Fastest
3832
- name: release to github
3933
id: create_release
34+
uses: softprops/action-gh-release@v2
4035
if: startsWith(github.ref,'refs/tags/')
41-
uses: actions/create-release@v1
42-
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4436
with:
45-
tag_name: ${{ github.sha }}
46-
release_name: ${{ github.sha }}
37+
files: rmdup.zip
38+
name: release ${{ github.sha}}
4739
draft: true
48-
prerelease: false
49-
50-
- name: publish to github
51-
uses: actions/upload-release-asset@v1
52-
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54-
with:
55-
upload_url: ${{ steps.create_release.outputs.upload_url }}
56-
asset_path: rmdup_${{github.sha}}.zip
57-
asset_name: rmdup_${{github.sha}}.zip
58-
asset_content_type: application/zip
40+
41+
42+

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bin/
22
obj/
3+
release/
34

0 commit comments

Comments
 (0)