-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (67 loc) · 2.08 KB
/
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
75
76
77
78
79
80
name: Build, Test and Release
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set PSModulePath
shell: pwsh
run: |
$PSModulePath = @(
[System.IO.Path]::Combine($Env:GITHUB_WORKSPACE, 'TMP', 'Modules'),
$Env:PSModulePath
) -join [System.IO.Path]::PathSeparator
"PSModulePath=$PSModulePath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Setup assets cache
id: assetscache
uses: actions/cache@v3
with:
path: |
TMP/Modules
key: ${{ hashFiles('Scripts/BuildDependencies.ps1') }}
- name: Download required assemblies
if: steps.assetscache.outputs.cache-hit != 'true'
shell: pwsh
run: ./Scripts/BuildDependencies.ps1
- name: Build module
shell: pwsh
run: ./Scripts/Build.ps1 -PublishArtifact -Version "${{steps.gitversion.outputs.LegacySemVerPadded}}"
- name: Publish release artifact
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: StageCoder.zip
path: StageCoder.zip
release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: StageCoder.zip
- name: Publish assets
uses: softprops/action-gh-release@v1
with:
files: StageCoder.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish module to PSGallery
shell: pwsh
run: |
Expand-Archive -Path 'StageCoder.zip'
Publish-Module -Path "./StageCoder/StageCoder" -NuGetApiKey $Env:PSGALLERY_KEY -Verbose
env:
PSGALLERY_KEY: ${{ secrets.PSGALLERY_KEY }}