-
-
Notifications
You must be signed in to change notification settings - Fork 12
130 lines (109 loc) · 4.76 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
update_release_draft:
name: Update release draft
runs-on: ubuntu-latest
outputs:
Release_Id: ${{ steps.create_release.outputs.id}}
Release_name: ${{ steps.create_release.outputs.name}}
Release_tag_name: ${{ steps.create_release.outputs.tag_name}}
Release_body: ${{ steps.create_release.outputs.body}}
Release_html_url: ${{ steps.create_release.outputs.html_url}}
Release_upload_url: ${{ steps.create_release.outputs.upload_url}}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Nerdbank.GitVersioning
uses: dotnet/nbgv@v0.4.2
with:
# Defines ALL version variables as environment variables, with a "NBGV_" prefix.
setAllVars: true
# Defines a few common version variables as environment variables, with a "Git" prefix (e.g. GitBuildVersion, GitBuildVersionSimple, GitAssemblyInformationalVersion).
setCommonVars: true
- uses: release-drafter/release-drafter@v6
if: github.ref == 'refs/heads/master' # Running this action only for master branch
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: ${{ env.NBGV_SemVer2 }}
prerelease: true
build:
needs: [update_release_draft]
runs-on: windows-2019
permissions:
checks: write
contents: write
env:
Configuration: Release
Release_body: ${{ needs.update_release_draft.outputs.Release_body }}
steps:
- name: Dump needs context
env:
NEEDS_CONTEXT: ${{ toJson(needs) }}
run: echo "$NEEDS_CONTEXT"
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2.0.0
- name: NuGet Restore
run: nuget restore
- name: Build
run: msbuild PowerShellWixExtension.sln
# NBGV is run as part of the build, so actions after here have access to NBGV_ env variables.
# For some reason, running msiexec from Pester doesn't work quite right.
- name: msiexec
run: |
Start-Process msiexec.exe -Wait -ArgumentList "/i Tests\PowerShellWixInlineScriptTest\bin\Release\PowerShellWixInlineScriptTest.msi /q /liwearucmopvx ${{ github.workspace }}\inlinescript-install.log"
Start-Process msiexec.exe -Wait -ArgumentList "/x Tests\PowerShellWixInlineScriptTest\bin\Release\PowerShellWixInlineScriptTest.msi /q /liwearucmopvx ${{ github.workspace }}\inlinescript-uninstall.log"
Start-Process msiexec.exe -Wait -ArgumentList "/i Tests\PowerShellWixTest\bin\Release\PowerShellWixTest.msi /q /liwearucmopvx ${{ github.workspace }}\script-install.log"
Start-Process msiexec.exe -Wait -ArgumentList "/x Tests\PowerShellWixTest\bin\Release\PowerShellWixTest.msi /q /liwearucmopvx ${{ github.workspace }}\script-uninstall.log"
- name: Pester
id: test_module
uses: zyborg/pester-tests-report@v1
with:
include_paths: tests
github_token: ${{ secrets.GITHUB_TOKEN }}
tests_fail_step: true
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: test logs
path: ${{ github.workspace }}\**\*.log
- name: Pack
run: nuget pack .\PowerShellWixExtension.nuspec -Version "$env:NBGV_NuGetPackageVersion" -Properties "Configuration=$env:Configuration;releasenotes=$env:Release_body"
- uses: actions/upload-artifact@v4
with:
name: nupkg
path: ${{ github.workspace }}\PowerShellWixExtension.${{ env.NBGV_NuGetPackageVersion }}.nupkg
- name: Remove existing release asset
uses: flcdrg/remove-release-asset-action@v4
if: github.ref == 'refs/heads/master' # Running this action only for master branch
with:
# The release id to remove asset from
release_id: ${{ needs.update_release_draft.outputs.Release_Id }}
# The name of the asset you want to remove
asset_name: PowerShellWixExtension.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/master' # Running this action only for master branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.update_release_draft.outputs.Release_upload_url }}
asset_path: ${{ github.workspace }}\PowerShellWixExtension.${{ env.NBGV_NuGetPackageVersion }}.nupkg
asset_name: PowerShellWixExtension.nupkg
asset_content_type: application/octet-stream