Skip to content

Merge pull request #155 from theohbrothers/docs/samples-update-test-e… #318

Merge pull request #155 from theohbrothers/docs/samples-update-test-e…

Merge pull request #155 from theohbrothers/docs/samples-update-test-e… #318

Workflow file for this run

name: ci-master-pr
on:
push:
branches:
- master
tags:
- '**'
pull_request:
branches:
- master
jobs:
test-powershell-core-windows-2022:
runs-on: windows-2022
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-5_1-windows-2022:
runs-on: windows-2022
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
powershell -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Test
run: |
powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-5_1-windows-2019:
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
powershell -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Test
run: |
powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
##########
# Docker #
##########
# Get powershell tags: https://mcr.microsoft.com/v2/powershell/tags/list
test-powershell-6_0-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:6.0.4-ubuntu-16.04-git
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-6_1-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:6.1.3-ubuntu-18.04-git
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-6_2-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:6.2.4-ubuntu-18.04-git
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-7_0-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:7.0.3-ubuntu-18.04-git
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-7_1-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:7.1.5-ubuntu-20.04-git
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-7_2-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:7.2-ubuntu-22.04-git
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-7_3-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:7.3-ubuntu-22.04-git
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-powershell-7_4-container:
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:7.4-ubuntu-22.04-git
steps:
- uses: actions/checkout@v1
- name: Install wget
run: |
apt-get update && apt-get install -y wget
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Test
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./test/test.ps1'
test-build_publish-powershell-5_1-windows-2022:
runs-on: windows-2022
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
powershell -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Generate module manifest
shell: bash
run: |
# Process applicable environment variables
export MODULE_VERSION='999.0.0'
export MODULE_NAME=$( basename "$( git rev-parse --show-toplevel )" )
# Build (Generates module manifest)
powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; Import-Module "./src/$env:MODULE_NAME/$env:MODULE_NAME.psm1" -Force; Invoke-Build'
- name: Publish module (Dry run)
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
shell: bash
run: |
# Process applicable environment variables
export MODULE_VERSION='999.0.0'
export MODULE_NAME=$( basename "$( git rev-parse --show-toplevel )" )
# Publish (Publishes module with -WhatIf)
powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; Import-Module "./src/$env:MODULE_NAME/$env:MODULE_NAME.psm1" -Force; Invoke-Publish -Repository PSGallery -DryRun'
build_publish-powershell-5_1-windows-2022:
needs:
- test-powershell-core-windows-2022
- test-powershell-5_1-windows-2022
- test-powershell-5_1-windows-2019
- test-powershell-6_0-container
- test-powershell-6_1-container
- test-powershell-6_2-container
- test-powershell-7_0-container
- test-powershell-7_1-container
- test-powershell-7_2-container
- test-powershell-7_3-container
- test-powershell-7_4-container
- test-build_publish-powershell-5_1-windows-2022
runs-on: windows-2022
steps:
- uses: actions/checkout@v1
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6'
- name: Powershell version
run: |
powershell -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Generate module manifest
shell: bash
run: |
# Process applicable environment variables
export MODULE_VERSION=$( echo "$GITHUB_REF" | sed -rn 's/^refs\/tags\/v(.*)/\1/p' )
export MODULE_NAME=$( basename "$( git rev-parse --show-toplevel )" )
# Build (Generates module manifest)
powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; Import-Module "./src/$env:MODULE_NAME/$env:MODULE_NAME.psm1" -Force; Invoke-Build'
- name: Publish module
if: startsWith(github.ref, 'refs/tags/')
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
shell: bash
run: |
# Process applicable environment variables
export MODULE_VERSION=$( echo "$GITHUB_REF" | sed -rn 's/^refs\/tags\/v(.*)/\1/p' )
export MODULE_NAME=$( basename "$( git rev-parse --show-toplevel )" )
# Publish (Publishes module)
powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; Import-Module "./src/$env:MODULE_NAME/$env:MODULE_NAME.psm1" -Force; Invoke-Publish -Repository PSGallery'
release:
needs:
- build_publish-powershell-5_1-windows-2022
runs-on: ubuntu-latest
container:
image: theohbrothers/docker-powershell:7.2-ubuntu-22.04-git
steps:
- uses: actions/checkout@v1
- name: Powershell version
run: |
pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable'
- name: Ignore git permissions
run: |
git config --global --add safe.directory "$( pwd )"
- name: Generate release notes
run: |
# Clone PSRepositoryReleaseManager
git clone https://github.com/theohbrothers/PSRepositoryReleaseManager.git --recurse-submodules --depth 1 --shallow-submodules --branch 'v0.12.0' # Specify tag ref to checkout to
# Process applicable environment variables
export PROJECT_DIRECTORY=$( git rev-parse --show-toplevel )
export RELEASE_TAG_REF=$( echo "$GITHUB_REF" | sed -rn 's/^refs\/tags\/(.*)/\1/p' )
# Generate (Generates release notes)
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./PSRepositoryReleaseManager/src/scripts/ci/Invoke-Generate.ps1'
cat PSRepositoryReleaseManager/.release-notes.md
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: release-notes
path: PSRepositoryReleaseManager/.release-notes.md
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Process applicable environment variables
export PROJECT_DIRECTORY=$( git rev-parse --show-toplevel )
export RELEASE_TAG_REF=$( echo "$GITHUB_REF" | sed -rn 's/^refs\/tags\/(.*)/\1/p' )
export RELEASE_NAMESPACE="$GITHUB_REPOSITORY_OWNER"
export RELEASE_REPOSITORY=$( basename "$( git rev-parse --show-toplevel )" )
# Release (Creates GitHub release)
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./PSRepositoryReleaseManager/src/scripts/ci/Invoke-Release.ps1'