Родитель
1570d7788f
Коммит
df60b7a7d9
|
@ -2,52 +2,50 @@
|
||||||
name: Build
|
name: Build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, 'release/*' ]
|
branches: [main, 'release/*']
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, 'release/*' ]
|
branches: [main, 'release/*']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: 'Tests'
|
name: Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Checkout
|
- name: Register repository
|
||||||
uses: actions/checkout@v3
|
shell: pwsh
|
||||||
|
run: |-
|
||||||
|
$Null = New-Item -Path out/repo -Type Directory -Force;
|
||||||
|
|
||||||
- name: Register repository
|
Invoke-WebRequest -Uri 'https://www.powershellgallery.com/api/v2/package/PSRule/1.11.1' -OutFile out/repo/PSRule.1.11.1.nupkg;
|
||||||
shell: pwsh
|
Invoke-WebRequest -Uri 'https://www.powershellgallery.com/api/v2/package/PSRule.Rules.MSFT.OSS/1.0.1' -OutFile out/repo/PSRule.Rules.MSFT.OSS.1.0.1.nupkg;
|
||||||
run: |-
|
Save-Module -Name PSRule.Rules.MSFT.OSS -Repository PSGallery -Path out/repo/;
|
||||||
$Null = New-Item -Path out/repo -Type Directory -Force;
|
Register-PSRepository -SourceLocation out/repo -Name Local -InstallationPolicy Trusted;
|
||||||
|
|
||||||
Invoke-WebRequest -Uri 'https://www.powershellgallery.com/api/v2/package/PSRule/1.11.1' -OutFile out/repo/PSRule.1.11.1.nupkg;
|
- name: Run PSRule v1
|
||||||
Invoke-WebRequest -Uri 'https://www.powershellgallery.com/api/v2/package/PSRule.Rules.MSFT.OSS/1.0.1' -OutFile out/repo/PSRule.Rules.MSFT.OSS.1.0.1.nupkg;
|
uses: ./
|
||||||
Save-Module -Name PSRule.Rules.MSFT.OSS -Repository PSGallery -Path out/repo/;
|
with:
|
||||||
Register-PSRepository -SourceLocation out/repo -Name Local -InstallationPolicy Trusted;
|
inputType: repository
|
||||||
|
modules: PSRule.Rules.MSFT.OSS
|
||||||
|
repository: Local
|
||||||
|
version: '1.11.1'
|
||||||
|
|
||||||
- name: Run PSRule v1
|
- name: Run PSRule v2
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
inputType: repository
|
inputType: repository
|
||||||
modules: PSRule.Rules.MSFT.OSS
|
modules: PSRule.Rules.MSFT.OSS
|
||||||
repository: Local
|
outcome: Problem
|
||||||
version: '1.11.1'
|
|
||||||
|
|
||||||
- name: Run PSRule v2
|
- name: Unregister repository
|
||||||
uses: ./
|
shell: pwsh
|
||||||
with:
|
if: always()
|
||||||
inputType: repository
|
run: |-
|
||||||
modules: PSRule.Rules.MSFT.OSS
|
Unregister-PSRepository -Name Local -ErrorAction Ignore;
|
||||||
outcome: Problem
|
|
||||||
|
|
||||||
- name: Unregister repository
|
|
||||||
shell: pwsh
|
|
||||||
if: always()
|
|
||||||
run: |-
|
|
||||||
Unregister-PSRepository -Name Local -ErrorAction Ignore;
|
|
||||||
|
|
||||||
run:
|
run:
|
||||||
name: Analyze repository
|
name: Analyze repository
|
||||||
|
@ -56,22 +54,21 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Checkout
|
- name: Run PSRule self analysis
|
||||||
uses: actions/checkout@v3
|
uses: ./
|
||||||
|
with:
|
||||||
|
inputType: repository
|
||||||
|
outputFormat: Markdown
|
||||||
|
outputPath: reports/report.md
|
||||||
|
modules: PSRule.Rules.MSFT.OSS
|
||||||
|
prerelease: true
|
||||||
|
|
||||||
- name: Run PSRule self analysis
|
- name: PSRule results
|
||||||
uses: ./
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
if: always()
|
||||||
inputType: repository
|
with:
|
||||||
outputFormat: Markdown
|
name: PSRule-results
|
||||||
outputPath: reports/report.md
|
path: reports/report.md
|
||||||
modules: PSRule.Rules.MSFT.OSS
|
|
||||||
prerelease: true
|
|
||||||
|
|
||||||
- name: PSRule results
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: PSRule-results
|
|
||||||
path: reports/report.md
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
name: Dependencies
|
name: Dependencies
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '50 1 * * 1' # At 01:50 AM, on Monday each week
|
- cron: '50 1 * * 1' # At 01:50 AM, on Monday each week
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
@ -23,7 +23,6 @@ jobs:
|
||||||
contents: write
|
contents: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
#
|
||||||
|
# Automated updates for release branches
|
||||||
|
#
|
||||||
|
|
||||||
|
# NOTES:
|
||||||
|
# This automatically bumps release branches to the latest stable tag.
|
||||||
|
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- created
|
||||||
|
- deleted
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
major:
|
||||||
|
type: choice
|
||||||
|
description: Determines the release branch to bump.
|
||||||
|
required: true
|
||||||
|
options:
|
||||||
|
- 'v1'
|
||||||
|
- 'v2'
|
||||||
|
default: v2
|
||||||
|
|
||||||
|
env:
|
||||||
|
RELEASE_BRANCH: ${{ inputs.major | 'v2' }}
|
||||||
|
LATEST_BRANCH: v2
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
branch:
|
||||||
|
name: Update release branch
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository == 'microsoft/ps-rule'
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
git config user.name github-actions
|
||||||
|
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
|
||||||
|
|
||||||
|
- name: Push release branch
|
||||||
|
run: |
|
||||||
|
Import-Module ./scripts/branches.psm1;
|
||||||
|
$latest = '${{ env.RELEASE_BRANCH }}' -eq '${{ env.LATEST_BRANCH }}';
|
||||||
|
Update-Branch -Remote origin -Major ${{ env.RELEASE_BRANCH }} -Latest:$latest;
|
||||||
|
shell: pwsh
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@ -10,7 +10,7 @@
|
||||||
name: 'Close stale issues'
|
name: 'Close stale issues'
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 1 * * *' # At 1:30 AM, daily
|
- cron: '30 1 * * *' # At 1:30 AM, daily
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
|
@ -19,21 +19,20 @@ jobs:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/stale@v7
|
||||||
|
with:
|
||||||
|
stale-issue-message: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs within 7 days.
|
||||||
|
Thank you for your contributions.
|
||||||
|
|
||||||
- uses: actions/stale@v7
|
close-issue-message: 'This issue was closed because it has not had any recent activity.'
|
||||||
with:
|
|
||||||
stale-issue-message: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs within 7 days.
|
|
||||||
Thank you for your contributions.
|
|
||||||
|
|
||||||
close-issue-message: 'This issue was closed because it has not had any recent activity.'
|
days-before-stale: 14
|
||||||
|
days-before-pr-stale: -1
|
||||||
|
|
||||||
days-before-stale: 14
|
days-before-close: 7
|
||||||
days-before-pr-stale: -1
|
days-before-pr-close: -1
|
||||||
|
|
||||||
days-before-close: 7
|
any-of-labels: 'question,duplicate,incomplete,waiting-feedback'
|
||||||
days-before-pr-close: -1
|
stale-issue-label: stale
|
||||||
|
|
||||||
any-of-labels: 'question,duplicate,incomplete,waiting-feedback'
|
|
||||||
stale-issue-label: stale
|
|
||||||
|
|
14
README.md
14
README.md
|
@ -12,6 +12,20 @@ To learn about PSRule and how to write your own rules see [Getting started][1].
|
||||||
|
|
||||||
To get the latest stable release use:
|
To get the latest stable release use:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Run PSRule analysis
|
||||||
|
uses: microsoft/ps-rule@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
To get the latest stable release by major version use:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Run PSRule analysis
|
||||||
|
uses: microsoft/ps-rule@v2
|
||||||
|
```
|
||||||
|
|
||||||
|
To get a specific release use:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run PSRule analysis
|
- name: Run PSRule analysis
|
||||||
uses: microsoft/ps-rule@v2.7.0
|
uses: microsoft/ps-rule@v2.7.0
|
||||||
|
|
|
@ -6,6 +6,12 @@ See [upgrade notes][upgrade-notes] for helpful information when upgrading from p
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
What's changed since v2.8.0:
|
||||||
|
|
||||||
|
- General improvements:
|
||||||
|
- Added support for action release branches by @BernieWhite.
|
||||||
|
[#214](https://github.com/microsoft/ps-rule/issues/214)
|
||||||
|
|
||||||
## v2.7.0
|
## v2.7.0
|
||||||
|
|
||||||
What's changed since v2.6.0:
|
What's changed since v2.6.0:
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
# Note:
|
||||||
|
# Handles bump to release branches.
|
||||||
|
|
||||||
|
function Update-Branch {
|
||||||
|
[CmdletBinding()]
|
||||||
|
[OutputType([void])]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $True)]
|
||||||
|
[String]$Major,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $True)]
|
||||||
|
[String]$Remote,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $False)]
|
||||||
|
[Switch]$Latest
|
||||||
|
)
|
||||||
|
process {
|
||||||
|
$latest = Get-LatestVersion -Remote $Remote -Major $Major;
|
||||||
|
|
||||||
|
Write-Host "Latest stable release is: $latest";
|
||||||
|
Write-Host "Checking out tag for: $latest"
|
||||||
|
|
||||||
|
git fetch --tags $Remote;
|
||||||
|
git checkout refs/tags/v$latest;
|
||||||
|
|
||||||
|
Write-Host "Updating release branch: $Major";
|
||||||
|
git push $Remote refs/tags/v$latest`:refs/heads/$Major --force;
|
||||||
|
|
||||||
|
if ($Latest) {
|
||||||
|
Write-Host "Updating latest to: $Major";
|
||||||
|
git push $Remote refs/tags/v$latest`:refs/heads/latest --force;
|
||||||
|
}
|
||||||
|
|
||||||
|
git checkout main;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-LatestVersion {
|
||||||
|
[CmdletBinding()]
|
||||||
|
[OutputType([String])]
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory = $True)]
|
||||||
|
[String]$Major,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $True)]
|
||||||
|
[String]$Remote
|
||||||
|
)
|
||||||
|
process {
|
||||||
|
return (gh api repos/microsoft/ps-rule/releases | Out-String | ConvertFrom-Json | Where-Object {
|
||||||
|
$_.prerelease -eq $False -and $_.name -like "$Major.*"
|
||||||
|
} | Select-Object -Property @{ Name = 'version'; Expression = { [System.Version]::Parse($_.name.Replace('v', '')) } } | Sort-Object -Property version -Descending -Top 1).Version.ToString();
|
||||||
|
}
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче