-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (53 loc) · 1.8 KB
/
build.yml
File metadata and controls
63 lines (53 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Build and Package
on: [push]
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: |
if ('${{ startsWith(github.ref, 'refs/tags/') }}' -eq 'true') {
dotnet publish -r win-x64 -c Release /p:Version=${{ github.ref_name }}
} else {
dotnet publish -r win-x64 -c Release
}
- name: Create zip artifact
run: |
Compress-Archive -Path .\bin\Release\net6.0-windows7.0\win-x64\publish\DOFConnect.dll -DestinationPath dofconnect -Force
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dofconnect
path: dofconnect.zip
retention-days: 7
create-release:
needs: [build-windows]
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: dofconnect
- name: ls
run: ls -alrt
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
generateReleaseNotes: true
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }}
allowUpdates: true
artifacts: "dofconnect*"
tag: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('v{0}', github.sha) }}
name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'Latest' }}