Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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.

1 change: 1 addition & 0 deletions .github/linters/.powershell-psscriptanalyzer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
}
}
ExcludeRules = @(
'PSAvoidUsingWriteHost', # This action runs on GitHub Actions which supports Write-Host.
'PSMissingModuleManifestField', # This rule is not applicable until the module is built.
'PSUseToExportFieldsInManifest'
)
Expand Down
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

- 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

- 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
18 changes: 10 additions & 8 deletions scripts/cleanup.ps1 → src/cleanup.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[CmdletBinding()]
param()

$PSStyle.OutputRendering = 'Ansi'

Import-Module -Name 'Helpers' -Force

$prereleaseName = $env:PUBLISH_CONTEXT_PrereleaseName
Expand All @@ -14,32 +16,32 @@ if ([string]::IsNullOrWhiteSpace($prereleaseName)) {

LogGroup "Cleanup prereleases for [$prereleaseName]" {
if ([string]::IsNullOrWhiteSpace($prereleaseTagsToCleanup)) {
Write-Output "No prereleases found to cleanup for [$prereleaseName]."
Write-Host "No prereleases found to cleanup for [$prereleaseName]."
return
}

$tagsToDelete = $prereleaseTagsToCleanup -split ',' | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }

if ($tagsToDelete.Count -eq 0) {
Write-Output "No prereleases found to cleanup for [$prereleaseName]."
Write-Host "No prereleases found to cleanup for [$prereleaseName]."
return
}

Write-Output "Found $($tagsToDelete.Count) prereleases to cleanup:"
$tagsToDelete | ForEach-Object { Write-Output " - $_" }
Write-Output ''
Write-Host "Found $($tagsToDelete.Count) prereleases to cleanup:"
$tagsToDelete | ForEach-Object { Write-Host " - $_" }
Write-Host ''

foreach ($tag in $tagsToDelete) {
Write-Output "Deleting prerelease: [$tag]"
Write-Host "Deleting prerelease: [$tag]"
if ($whatIf) {
Write-Output "WhatIf: gh release delete $tag --cleanup-tag --yes"
Write-Host "WhatIf: gh release delete $tag --cleanup-tag --yes"
} else {
gh release delete $tag --cleanup-tag --yes
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to delete release [$tag]."
exit $LASTEXITCODE
}
Write-Output "Successfully deleted release [$tag]."
Write-Host "Successfully deleted release [$tag]."
}
}

Expand Down
Loading
Loading