⬆️ Bump softprops/action-gh-release from 1 to 2 #98
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: Validate Changes | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
lint-with-psscriptanalyzer: | |
name: Lint with PSScriptAnalyzer | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Lint with PSScriptAnalyzer | |
uses: pwshrc/actions-invoke-lib-dependent-pwsh@v0.2.10 | |
with: | |
run: ./build/lint.ps1 -CI -NoFail:([bool]"${{ secrets.MANDATE_LINT_SUCCESS != 'true' }}") | |
determine-version: | |
name: Determine Version with GitVersion | |
runs-on: ubuntu-latest | |
steps: | |
- name: Populate GitVersion variables | |
id: gitversion_vars | |
uses: pwshrc/actions-determine-version@v0.8.7 | |
with: | |
mode: 'upload' | |
create-releasenotes: | |
name: Create Release Notes | |
needs: determine-version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create release notes | |
uses: pwshrc/actions-create-release-notes@v0.8.11 | |
with: | |
mode: 'upload' | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
build-release-package: | |
name: Build Release Package | |
needs: [create-releasenotes] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Populate GitVersion | |
id: gitversion_vars | |
uses: pwshrc/actions-determine-version@v0.8.7 | |
with: | |
mode: 'download' | |
- name: Populate release notes | |
id: get-releasenotes | |
uses: pwshrc/actions-create-release-notes@v0.8.11 | |
with: | |
mode: 'download' | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Build PSGallery package | |
uses: pwshrc/actions-invoke-lib-dependent-pwsh@v0.2.10 | |
env: | |
PackageVersion: ${{ steps.gitversion_vars.outputs.NuGetVersionV2 }} | |
ModuleVersionMajor: ${{ steps.gitversion_vars.outputs.Major }} | |
ModuleVersionMinor: ${{ steps.gitversion_vars.outputs.Minor }} | |
ModuleVersionPatch: ${{ steps.gitversion_vars.outputs.Patch }} | |
PackageVersionPrereleaseTag: ${{ steps.gitversion_vars.outputs.PreReleaseTag }} | |
CommitSha: ${{ steps.gitversion_vars.outputs.Sha }} | |
ReleaseNotesFilepath: ${{ steps.get-releasenotes.outputs.filepath }} | |
with: | |
run: | | |
[string] $releaseNotes = (Get-Content -Raw -Path ./out/release-notes.md -Encoding UTF8).Trim() | |
[Version] $moduleVersion = [Version]::new($Env:ModuleVersionMajor, $Env:ModuleVersionMinor, $Env:ModuleVersionPatch) | |
./build/package.ps1 -PackageVersion $Env:PackageVersion -ModuleVersion $moduleVersion -PackageVersionPrereleaseTag $Env:PackageVersionPrereleaseTag -ReleaseNotes $releaseNotes -CommitSha $Env:CommitSha | |
- name: "Create artifact: PSGallery-package" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: PSGallery-package | |
path: ./out/*.nupkg | |
if-no-files-found: error | |
tests: | |
name: Test with Pester on ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental == 'true' }} | |
strategy: | |
fail-fast: ${{ github.ref == 'refs/heads/main' }} | |
matrix: | |
# See: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners | |
os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-20.04, windows-2019] | |
include: | |
- os: windows-latest | |
codecov_os: windows | |
- os: ubuntu-latest | |
codecov_os: linux | |
- os: macos-latest | |
codecov_os: macos | |
experimental: true | |
- os: ubuntu-20.04 | |
codecov_os: linux | |
experimental: true | |
- os: windows-2019 | |
codecov_os: windows | |
experimental: true | |
runs-on: ${{ matrix.os }} | |
needs: build-release-package | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: "Get artifact: PSGallery-package" | |
uses: actions/download-artifact@v3 | |
with: | |
name: PSGallery-package | |
path: ./out/ | |
- name: Test with Pester | |
uses: pwshrc/actions-invoke-lib-dependent-pwsh@v0.2.10 | |
with: | |
run: ./build/test.ps1 -UsePackageExport -CI -OutputFilesPrefix "${{ matrix.os }}-" -NoFail:([bool]"${{ matrix.experimental }}") | |
- name: "Create artifact: tests-${{ matrix.os }}" | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: "tests-${{ matrix.os }}" | |
path: ./out/*.xml | |
if-no-files-found: error | |
- name: Upload coverage report to Codecov | |
uses: codecov/codecov-action@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
fail_ci_if_error: true | |
flags: ${{ matrix.codecov_os }},unittests | |
directory: ./out | |
files: "*coverage.xml" | |
os: ${{ matrix.codecov_os }} | |
env_vars: "OS" |