-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (78 loc) · 2.3 KB
/
ci.github-action.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
run-name: ${{ github.actor }} ${{ github.event_name }}
on:
push:
branches:
- feature/*
- main
pull_request:
branches:
- main
env:
SHELL: powershell
jobs:
validate:
runs-on: windows-latest
defaults:
run:
shell: ${{ env.SHELL }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
uses: "./.github/template/setup"
with:
shell: ${{ env.SHELL }}
- name: Validate
run: Invoke-Build validate
package:
needs: validate
runs-on: windows-latest
defaults:
run:
shell: ${{ env.SHELL }}
steps:
- uses: actions/checkout@v4
- name: Setup Environment
uses: "./.github/template/setup"
with:
shell: ${{ env.SHELL }}
- name: Generate Package
run: |
Invoke-Build clean
Invoke-Build generate_package -zipPackage $true
- name: Save Package
uses: actions/upload-artifact@v3
with:
name: package
path: dist/ValidateJson.zip
retention-days: 7
release:
needs: package
permissions:
contents: write
runs-on: windows-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
defaults:
run:
shell: ${{ env.SHELL }}
steps:
- uses: actions/download-artifact@v3
with:
name: package
- name: Get Version
id: version
run: |
Expand-Archive -Path ValidateJson.zip
$versionNumber = (Import-PowerShellDataFile .\package\ValidateJson.psd1)["ModuleVersion"]
Write-Output "version_number=$versionNumber" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
Remove-Item -Path .\package\ -Force -Recurse
- name: Put Version Number in Package
run: Move-Item ValidateJson.zip ValidateJson-${{ steps.version.outputs.version_number }}.zip
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref }} ${{ steps.version.outputs.version_number }}
prerelease: ${{ github.ref != 'refs/heads/main' }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
ValidateJson-${{ steps.version.outputs.version_number }}.zip