-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.75 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
name: CI
run-name: ${{ github.actor }} CI ${{ github.event_name }}
on:
push:
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: Generate Module Manifest
run: Invoke-Build generate_manifest
- name: Set Version
id: version
run: |
pwd
ls
$versionNumber = (Import-PowerShellDataFile .\src\ValidateJson\ValidateJson.psd1)["ModuleVersion"]
echo "version_number=$versionNumber" >> $GITHUB_OUTPUT
- name: Validate
run: Invoke-Build validate
- name: Generate Package
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
run: |
Invoke-Build clean
Invoke-Build generate_package -zipPackage $true
- name: Save Package
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v3
with:
name: package
path: dist/ValidateJson.zip
retention-days: 7
- name: Create Release
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }} ${{ steps.version.outputs.version_number }}
prerelease: ${{ github.ref != 'refs/heads/main' }}