forked from Readify/PwshZendesk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move from Azure Pipelines to Github Actions +semver: none
- Pinned version of Pester and PSScriptAnalyzer - Updated Copyright statements.
- Loading branch information
Showing
30 changed files
with
209 additions
and
258 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
PESTER_VERSION: '4.10.1' | ||
PSSA_VERSION: '1.19.1' | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
prep: | ||
runs-on: 'ubuntu-20.04' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: | | ||
.modules | ||
key: ${{ env.PSSA_VERSION }}-${{ env.PESTER_VERSION }} | ||
|
||
- name: Install Modules | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: | | ||
$modules = '[ | ||
{ "Name": "PSScriptAnalyzer", "Version": "${{ env.PSSA_VERSION }}" }, | ||
{ "Name": "Pester", "Version": "${{ env.PESTER_VERSION }}" } | ||
]' | ConvertFrom-Json | ||
$modPath = '.modules' | ||
if (-not (Test-Path -Path $modPath)) { | ||
$null = New-Item -Path $modPath -ItemType Director | ||
} | ||
foreach ($module in $modules) { | ||
$null = Save-Module -Name $module.Name -RequiredVersion $module.Version -Repository 'PSGallery' -Path $modPath -Confirm:$false -ErrorAction 'Stop' | ||
} | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: PwshZendesk | ||
path: '**/*' | ||
|
||
test: | ||
needs: prep | ||
runs-on: ${{ matrix.os }} | ||
if: false | ||
strategy: | ||
matrix: | ||
os: [ macos-11, ubuntu-20.04, windows-2019, windows-2022 ] | ||
|
||
steps: | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
|
||
- name: PSScriptAnalyzer | ||
run: | | ||
$pssa = Import-Module -Name "$pwd/PwshZendesk/.modules/PSScriptAnalyzer/${{ env.PSSA_VERSION }}/PSScriptAnalyzer.psd1" -Passthru | ||
Get-ChildItem -Directory | Invoke-ScriptAnalyzer | Format-Table -AutoSize | ||
- name: Pester summary | ||
id: pester | ||
run: | | ||
$pester = Import-Module -Name "$pwd/PwshZendesk/.modules/Pester/${{ env.PESTER_VERSION }}/Pester.psd1" -PassThru | ||
Invoke-Pester -EnableExit -Show Fails | ||
- name: Pester - Windows Powershell | ||
if: runner.os == 'Windows' | ||
shell: powershell | ||
run: | | ||
$pssa = Import-Module -Name "$pwd/PwshZendesk/.modules/PSScriptAnalyzer/${{ env.PSSA_VERSION }}/PSScriptAnalyzer.psd1" -Passthru | ||
Get-ChildItem -Directory | Invoke-ScriptAnalyzer | Format-Table -AutoSize | ||
- name: Pester - Windows Powershell | ||
if: runner.os == 'Windows' | ||
shell: powershell | ||
run: | | ||
$pester = Import-Module -Name "$pwd/PwshZendesk/.modules/Pester/${{ env.PESTER_VERSION }}/Pester.psd1" -PassThru | ||
Invoke-Pester -EnableExit -Show Summary | ||
release: | ||
# needs: test | ||
runs-on: 'ubuntu-20.04' | ||
if: github.ref == 'refs/heads/main' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: '5.x' | ||
|
||
- name: GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
id: gitversion | ||
with: | ||
useConfigFile: true | ||
|
||
- name: Update Module Manifest | ||
run: | | ||
$manifest = Get-Content -Path ./PwshZendesk.psd1 | ||
$manifest = $manifest | ForEach-Object { | ||
$_ -replace "(?<=ModuleVersion\s+=\s+('|`"))[^'`"]+(?=('|`"))", '${{ steps.gitversion.outputs.semVer }}' | ||
} | ||
$manifest | Set-Content -Path ./PwshZendesk.psd1 | ||
- name: Commit updated Module Manifest | ||
run: | | ||
git add ./PwshZendesk.psd1 | ||
git config user.email "[email protected]" | ||
git config user.name "Rob McBot" | ||
git commit --amend --no-edit | ||
git push --force | ||
git tag ${{ steps.gitversion.outputs.semVer }} | ||
git push --tags --force | ||
- run: zip -r PwshZendesk.zip . -x .\*/\* -x .\* | ||
shell: bash | ||
|
||
# - name: Create Release | ||
# uses: actions/create-release@v1 | ||
# id: create_release | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# tag_name: ${{ steps.gitversion.outputs.semVer }} | ||
# release_name: Release ${{ steps.gitversion.outputs.semVer }} | ||
# draft: false | ||
# prerelease: false | ||
|
||
# - name: Upload Release Asset | ||
# id: upload-release-asset | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: PwshZendesk.zip | ||
# asset_name: PwshZendesk.zip | ||
# asset_content_type: application/zip | ||
|
||
- name: Publish Module | ||
run: | | ||
$cred = [PSCredential]::new('RobFaie', ('${{ secrets.GITHUB_TOKEN }}' | ConvertTo-SecureString -AsPlainText -Force)) | ||
$registerParams = @{ | ||
Name = 'Github' | ||
SourceLocation = 'https://nuget.pkg.github.com/RobFaie/index.json' | ||
PublishLocation = 'https://nuget.pkg.github.com/RobFaie/index.json' | ||
Credential = $cred | ||
} | ||
Register-PSRepository @registerParams | ||
Publish-Module -Path '.' -Repository 'Github' -Credential $cred -NuGetApiKey '${{ secrets.GITHUB_TOKEN }}' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mode: Mainline | ||
no-bump-message: '\[skip ci\]|\+semver:\s?(none|skip)' |
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
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
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
Oops, something went wrong.