-
Notifications
You must be signed in to change notification settings - Fork 3
104 lines (99 loc) · 3.07 KB
/
ModuleBuildTestRelease.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Module Build, Test and Release
on:
push:
branches:
- main
paths-ignore:
- CHANGELOG.md
tags:
- v*
#tags-ignore:
#- '*-*'
pull_request:
workflow_dispatch:
env:
buildFolderName: output
buildArtifactName: output
testResultFolderName: testResults
defaultBranch: main
Agent.Source.Git.ShallowFetchDepth: 0
jobs:
Build_Stage_Package_Module:
name: Package Module
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate ModuleVersion (GitVersion)
id: GitVersion
run: |
dotnet tool install --global GitVersion.Tool
dotnet-gitversion
$gitVersionObject = dotnet-gitversion | ConvertFrom-Json
Write-Output "NuGetVersionV2=$($gitVersionObject.NuGetVersionV2)" >> $env:GITHUB_OUTPUT
shell: pwsh
- name: Build & Package Module
shell: pwsh
run: './build.ps1 -ResolveDependency -Tasks Pack'
env:
ModuleVersion: ${{ steps.GitVersion.outputs.NuGetVersionV2 }}
- name: Publish Build Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.buildArtifactName }}
path: ${{ env.buildFolderName }}/
Test_Stage_test_windows_ps:
name: Windows (Windows PowerShell)
runs-on: windows-latest
needs:
- Build_Stage_Package_Module
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.buildArtifactName }}
path: ${{ env.buildFolderName }}/
- name: Run Tests
shell: powershell
run: './build.ps1 -Tasks Test'
- name: Publish Test Artifact
uses: actions/upload-artifact@v3
with:
path: ${{ env.buildFolderName }}/${{ env.testResultFolderName }}/
name: CodeCoverageWinPS51
Deploy_Stage_Deploy_Module:
name: Deploy Module
runs-on: ubuntu-latest
needs:
- Test_Stage_test_windows_ps
if: (success() && ((github.ref == 'refs/heads/main') || startsWith(github.ref, 'refs/tags/')) && (contains(github.repository_owner, 'ykuijs')))
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.buildArtifactName }}
path: ${{ env.buildFolderName }}/
- name: Publish Release
shell: pwsh
run: |
Get-ChildItem
./build.ps1 -Tasks Publish
env:
GitHubToken: ${{ secrets.GITHUB_TOKEN }}
GalleryApiToken: ${{ secrets.GalleryApiToken }}
ReleaseBranch: ${{ env.defaultBranch }}
MainGitBranch: ${{ env.defaultBranch }}
- name: Send Changelog PR
shell: pwsh
run: './build.ps1 -Tasks Create_ChangeLog_GitHub_PR'
env:
GitHubToken: ${{ secrets.GITHUB_TOKEN }}
ReleaseBranch: ${{ env.defaultBranch }}
MainGitBranch: ${{ env.defaultBranch }}