Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/linters/.jscpd.json

This file was deleted.

18 changes: 0 additions & 18 deletions .github/release.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/Linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
VALIDATE_BIOME_FORMAT: false
VALIDATE_JSCPD: false
VALIDATE_JSON_PRETTIER: false
VALIDATE_MARKDOWN_PRETTIER: false
VALIDATE_YAML_PRETTIER: false
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Auto-Release
name: Release

run-name: "Auto-Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"
run-name: "Release - [${{ github.event.pull_request.title }} #${{ github.event.pull_request.number }}] by @${{ github.actor }}"

on:
pull_request:
Expand All @@ -12,6 +12,9 @@ on:
- reopened
- synchronize
- labeled
paths:
- 'action.yml'
- 'src/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -22,15 +25,15 @@ permissions:
pull-requests: write

jobs:
Auto-Release:
Release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Auto-Release
uses: PSModule/Auto-Release@eabd533035e2cb9822160f26f2eda584bd012356 # v1.9.5
- name: Release
uses: PSModule/Release-GHRepository@88c70461c8f16cc09682005bcf3b7fca4dd8dc1a # v2.0.1
with:
IncrementalPrerelease: false
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ inputs:
required: false
default: 'true'
IncrementalPrerelease:
description: Control wether to automatically increment the prerelease number. If disabled, the action will ensure only one prerelease exists for a given branch.
description: Control whether to automatically increment the prerelease number. If disabled, the action will ensure only one prerelease exists for a given branch.
required: false
default: 'true'
DatePrereleaseFormat:
Expand Down Expand Up @@ -102,7 +102,7 @@ runs:
PSMODULE_PUBLISH_PSMODULE_INPUT_PatchLabels: ${{ inputs.PatchLabels }}
PSMODULE_PUBLISH_PSMODULE_INPUT_VersionPrefix: ${{ inputs.VersionPrefix }}
PSMODULE_PUBLISH_PSMODULE_INPUT_WhatIf: ${{ inputs.WhatIf }}
run: ${{ github.action_path }}/scripts/init.ps1
run: ${{ github.action_path }}/src/init.ps1
Comment thread Dismissed

- name: Download module artifact
if: env.PUBLISH_CONTEXT_ShouldPublish == 'true' || inputs.WhatIf == 'true'
Expand All @@ -123,12 +123,12 @@ runs:
PSMODULE_PUBLISH_PSMODULE_INPUT_UsePRBodyAsReleaseNotes: ${{ inputs.UsePRBodyAsReleaseNotes }}
PSMODULE_PUBLISH_PSMODULE_INPUT_UsePRTitleAsReleaseName: ${{ inputs.UsePRTitleAsReleaseName }}
PSMODULE_PUBLISH_PSMODULE_INPUT_UsePRTitleAsNotesHeading: ${{ inputs.UsePRTitleAsNotesHeading }}
run: ${{ github.action_path }}/scripts/publish.ps1
run: ${{ github.action_path }}/src/publish.ps1
Comment thread Dismissed
Comment thread
MariusStorhaug marked this conversation as resolved.

- name: Cleanup Prereleases
if: env.PUBLISH_CONTEXT_ShouldCleanup == 'true' || inputs.WhatIf == 'true'
shell: pwsh
working-directory: ${{ inputs.WorkingDirectory }}
env:
PSMODULE_PUBLISH_PSMODULE_INPUT_WhatIf: ${{ inputs.WhatIf }}
run: ${{ github.action_path }}/scripts/cleanup.ps1
run: ${{ github.action_path }}/src/cleanup.ps1
Comment thread Dismissed
File renamed without changes.
File renamed without changes.
16 changes: 9 additions & 7 deletions scripts/publish.ps1 → src/publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ LogGroup 'Install module dependencies' {
}

LogGroup 'Publish-ToPSGallery' {
$releaseType = if ($createPrerelease) { 'New prerelease' } else { 'New release' }
if ($createPrerelease) {
$publishPSVersion = "$($newVersion.Major).$($newVersion.Minor).$($newVersion.Patch)-$($newVersion.Prerelease)"
} else {
$publishPSVersion = "$($newVersion.Major).$($newVersion.Minor).$($newVersion.Patch)"
}
$psGalleryReleaseLink = "https://www.powershellgallery.com/packages/$name/$publishPSVersion"
Write-Output "Publish module to PowerShell Gallery using API key from environment."
Write-Output 'Publish module to PowerShell Gallery using API key from environment.'
if ($whatIf) {
Write-Output "Publish-PSResource -Path $modulePath -Repository PSGallery -ApiKey ***"
} else {
Expand All @@ -103,11 +104,11 @@ LogGroup 'Publish-ToPSGallery' {
if ($whatIf) {
Write-Output (
"gh pr comment $prNumber -b " +
"'Module [$name - $publishPSVersion]($psGalleryReleaseLink) published to the PowerShell Gallery.'"
"'✅ $releaseType`: PowerShell Gallery - [$name $publishPSVersion]($psGalleryReleaseLink)'"
)
} else {
Write-Host "::notice::Module [$name - $publishPSVersion] published to the PowerShell Gallery."
gh pr comment $prNumber -b "Module [$name - $publishPSVersion]($psGalleryReleaseLink) published to the PowerShell Gallery."
Write-Host "::notice title=✅ $releaseType`: PowerShell Gallery - $name $publishPSVersion::$psGalleryReleaseLink"
gh pr comment $prNumber -b "✅ $releaseType`: PowerShell Gallery - [$name $publishPSVersion]($psGalleryReleaseLink)"
if ($LASTEXITCODE -ne 0) {
Write-Error 'Failed to comment on the pull request.'
exit $LASTEXITCODE
Expand Down Expand Up @@ -177,19 +178,20 @@ LogGroup 'New-GitHubRelease' {
Remove-Item -Path $notesFilePath -Force
}

$releaseType = if ($createPrerelease) { 'New prerelease' } else { 'New release' }
if ($whatIf) {
Write-Output (
"gh pr comment $prNumber -b " +
"'GitHub release for $name $newVersion has been created.'"
"'✅ $releaseType`: GitHub - $name $newVersion'"
)
} else {
gh pr comment $prNumber -b "GitHub release for $name [$newVersion]($releaseURL) has been created."
gh pr comment $prNumber -b "✅ $releaseType`: GitHub - [$name $newVersion]($releaseURL)"
if ($LASTEXITCODE -ne 0) {
Write-Error 'Failed to comment on the pull request.'
exit $LASTEXITCODE
}
}
Write-Host "::notice::Release created: [$newVersion]"
Write-Host "::notice title=✅ $releaseType`: GitHub - $name $newVersion::$releaseURL"
}

Write-Output "Publishing complete. Version: [$($newVersion.ToString())]"
Loading