Merge pull request #9 from avarga77/main #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |