-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 2.08 KB
/
deploy.yml
File metadata and controls
79 lines (68 loc) · 2.08 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build and Deploy
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
test:
name: Test
runs-on: windows-latest
steps:
- name: Check out code
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Run tests
shell: pwsh
run: |
Test-ModuleManifest -Path .\PSF.psd1 -Verbose -ErrorAction Stop
.\.ExecuteTests.ps1
deploy:
name: Tag and Deploy
runs-on: windows-latest
needs: [test]
if: contains(github.ref, 'master')
steps:
- name: Check out code
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.3.3
with:
versionSpec: "6.x"
- name: Version with GitVersion # https://github.com/marketplace/actions/use-actions
id: gitversion
uses: gittools/actions/gitversion/execute@v4.3.3
- name: Push version tag
uses: tvdias/github-tagger@v0.0.2
continue-on-error: true
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.gitversion.outputs.FullSemVer }}
- name: Update module manifest
shell: pwsh
run: |
Update-ModuleManifest -Path .\PSF.psd1 -ModuleVersion ${{ steps.gitversion.outputs.MajorMinorPatch }}
- name: Update copyright year
shell: pwsh
run: |
$year = (Get-Date).Year
(Get-Content .\PSF.psd1) -replace "(?<=Copyright\s*=\s*'\(c\) )\d{4}", $year | Set-Content .\PSF.psd1
- name: Copy files to staging directory
shell: pwsh
run: |
$DestPath = ".\Modules\PSF\"
New-Item -Path $DestPath -Type Directory -Force
Copy-Item .\PSF.ps* $DestPath
Copy-Item .\functions $DestPath -Recurse
- name: Publish to gallery
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
shell: pwsh
run: |
Publish-Module -Path ".\Modules\PSF\" -NuGetApiKey $env:NUGET_KEY -Verbose