-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (63 loc) · 2.37 KB
/
main.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Build
on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- .github/workflows/main.yml
- src/**
jobs:
build:
runs-on: windows-2019
env:
Configuration: Release
Project: MQTTLib
Solution: .\src\MQTTLib\MQTTLib.csproj
Bin: MQTTLib.dll
steps:
- uses: actions/checkout@v2
# setup MSBuild
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet.exe
uses: nuget/setup-nuget@v1
# Runs a multiple command using the runners shell
- name: Restore Nuget
run: Nuget restore ${env:Solution}
# Runs a multiple command using the runners shell
- name: Build Solution
run: msbuild ${env:Solution} /p:Configuration=${env:Configuration}
- name: Set the version environment variable
run: |
$file = ".\src\MQTTLib\bin\${env:Configuration}\${env:Bin}"
$WINS_VERSION = $(Get-Item $file).VersionInfo.ProductVersion
Write-Host WINS_VERSION $WINS_VERSION
echo "WINS_VERSION=$WINS_VERSION" >> $env:GITHUB_ENV
$TIMESTAMP = Get-Date -Format "yyyyMMddHHmmss"
Write-Host TIMESTAMP $TIMESTAMP
echo "TIMESTAMP=$TIMESTAMP" >> $env:GITHUB_ENV
- name: Deploy & zip
run: |
New-Item bin -ItemType Directory
Copy-Item .\src\MQTTLib\bin\${env:Configuration}\MQTTLib.dll .\bin
Copy-Item .\src\MQTTLib\bin\${env:Configuration}\MQTTnet.dll .\bin
Copy-Item .\src\MQTTLib\bin\${env:Configuration}\BouncyCastle.Crypto.dll .\bin
Compress-Archive -Path .\bin\*.* -DestinationPath ${{ env.Project }}.zip
- name: Create a Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.TIMESTAMP }}
release_name: Release ${{ env.TIMESTAMP }} (${{ env.Project }} ${{ env.WINS_VERSION }})
- 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: ./${{ env.Project }}.zip
asset_name: ${{ env.Project }}.zip
asset_content_type: application/zip