-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (63 loc) · 2.55 KB
/
tag-and-release.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
name: Tag, Release, and Publish to Gallery
on:
workflow_dispatch:
jobs:
run-build-test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Run the build test workflow
run: gh workflow run build-test.yml
env:
GH_TOKEN: ${{ github.token }}
confirm-build-test:
needs: run-build-test
runs-on: windows-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Wait for the runs to start
run: start-sleep 60
- name: Get run IDs
run: |
$runid=((& gh run list --workflow build-test.yml --json databaseId --limit 1) | convertfrom-json).databaseId
echo "RUNID=$runid" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: confirm build succeeded
run: |
$runstatus=""
while (($runstatus -ne "success") -AND ($runstatus -ne "failure")) {
start-sleep 15
$runstatus=((& gh run view $env:RUNID --exit-status --json conclusion) | Convertfrom-json).conclusion
}
if ($runstatus -eq "failure") {
exit 1
} else {
exit 0
}
publish-built-module:
needs: confirm-build-test
runs-on: windows-latest
env:
GH_TOKEN: ${{ github.token }}
GalKey: ${{ secrets.PSGALLERY }}
steps:
- uses: actions/checkout@v4
- uses: fregante/[email protected]
- name: Build and publish module
run: |
"Building and publishing module and committing changes" | out-host;
Install-PSResource -Name PlatyPS -TrustRepository -Version 0.14.2 -Scope CurrentUser -AcceptLicense
$releaseNote = (git log -1 --pretty=%B)
"Setting release note to last commit message:`n$releaseNote" | out-host;
"Building docs, module, and incrementing version..." | out-host;
.\build.ps1 -releasenote "$($releaseNote | out-string)"
$version = (Test-ModuleManifest .\FogApi\FogApi.psd1).version
"Pushing Changes from publish" | out-host;
git add -A
git commit -m "$($releaseNote | out-string) - publish build for $version"
git push
"Publishing module to gallery..." | out-host;
Publish-PSResource -apikey $env:GalKey -Path .\_module_build\FogApi -Repository PSGallery;
"Creating Github Release..." | out-host;
gh release create $version --latest --generate-notes --target master