Skip to content

Commit

Permalink
Merge branch 'refactor/entrypoint-move-scripts-to-project-root-direct…
Browse files Browse the repository at this point in the history
…ory'
  • Loading branch information
joeltimothyoh committed Aug 21, 2024
2 parents 41c610e + d9a4ee0 commit b4f74f4
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-master-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ jobs:
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"; ./src/scripts/ci/Invoke-Generate.ps1'
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./Invoke-Generate.ps1'
cat .release-notes.md
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -257,4 +257,4 @@ jobs:
export RELEASE_REPOSITORY=$( basename "$( git rev-parse --show-toplevel )" )
# Release (Creates GitHub release)
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./src/scripts/ci/Invoke-Release.ps1'
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./Invoke-Release.ps1'
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The project provides a set of [entrypoint scripts](src/scripts/ci) for generatin

#### Generating release notes

The entrypoint script [`Invoke-Generate.ps1`](src/scripts/ci/Invoke-Generate.ps1) is used to generate release notes for any local git repository. To do so, simply define applicable [environment variables](#environment-variables-1) before executing the entrypoint script.
The entrypoint script [`Invoke-Generate.ps1`](Invoke-Generate.ps1) is used to generate release notes for any local git repository. To do so, simply define applicable [environment variables](#environment-variables-1) before executing the entrypoint script.

The project includes [inbuilt](.vscode/tasks.json) and [samples](docs/samples/.vscode) of `.vscode/tasks.json` for generating release notes via [*Build Tasks*](https://code.visualstudio.com/docs/editor/tasks) in [VSCode](https://code.visualstudio.com/). Simply execute relevant build task(s) while entering custom or default values per variable prompt.

Expand All @@ -105,7 +105,7 @@ Generating of release notes supports all tag refs. Tags *need not* follow [Seman

#### Creating releases

The entrypoint script [`Invoke-Release.ps1`](src/scripts/ci/Invoke-Release.ps1) can be used to create releases for GitHub repositories. To do so, simply define applicable [environment variables](#environment-variables-1) before executing the entrypoint script.
The entrypoint script [`Invoke-Release.ps1`](Invoke-Release.ps1) can be used to create releases for GitHub repositories. To do so, simply define applicable [environment variables](#environment-variables-1) before executing the entrypoint script.

The project includes [inbuilt](.vscode/tasks.json) and [samples](docs/samples/.vscode) of `.vscode/tasks.json` for creating releases via [*Build Tasks*](https://code.visualstudio.com/docs/editor/tasks) in [VSCode](https://code.visualstudio.com/). Simply execute relevant build task(s) while entering custom or default values per variable prompt. Note that due to the inability to enter multiline strings in build tasks, the options `RELEASE_NOTES_CONTENT` and `RELEASE_ASSETS` are presently unavailable and limited in usability respectively.

Expand Down Expand Up @@ -162,10 +162,10 @@ export RELEASE_NAMESPACE="$GITHUB_REPOSITORY_OWNER"
export RELEASE_REPOSITORY=$( basename "$( git rev-parse --show-toplevel )" )

# Generate (Generates release notes)
pwsh -NoLogo -NonInteractive -NoProfile -Command './PSRepositoryReleaseManager/src/scripts/ci/Invoke-Generate.ps1'
pwsh -NoLogo -NonInteractive -NoProfile -Command './PSRepositoryReleaseManager/Invoke-Generate.ps1'

# Release (Creates GitHub release)
pwsh -NoLogo -NonInteractive -NoProfile -Command './PSRepositoryReleaseManager/src/scripts/ci/Invoke-Release.ps1'
pwsh -NoLogo -NonInteractive -NoProfile -Command './PSRepositoryReleaseManager/Invoke-Release.ps1'
```

**Note:** Ensure the environment variable [`GITHUB_API_TOKEN`](#github-api-token) is defined prior to creating releases.
Expand Down
8 changes: 4 additions & 4 deletions docs/samples/.vscode/tasks.submodule.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,25 @@
{
"label": "[PSRepositoryReleaseManager] Generate release notes (pwsh)",
"type": "shell",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/src/scripts/ci/Invoke-Generate.ps1'",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/Invoke-Generate.ps1'",
"group": "build"
},
{
"label": "[PSRepositoryReleaseManager] Generate release notes (powershell)",
"type": "shell",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/src/scripts/ci/Invoke-Generate.ps1'",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/Invoke-Generate.ps1'",
"group": "build"
},
{
"label": "[PSRepositoryReleaseManager] Create release (pwsh)",
"type": "shell",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/src/scripts/ci/Invoke-Release.ps1'",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/Invoke-Release.ps1'",
"group": "build"
},
{
"label": "[PSRepositoryReleaseManager] Create release (powershell)",
"type": "shell",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/src/scripts/ci/Invoke-Release.ps1'",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./build/PSRepositoryReleaseManager/Invoke-Release.ps1'",
"group": "build"
}
]
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/ci/github/github-workflows.linux-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
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'
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./PSRepositoryReleaseManager/Invoke-Generate.ps1'
cat PSRepositoryReleaseManager/.release-notes.md
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -63,4 +63,4 @@ jobs:
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'
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./PSRepositoryReleaseManager/Invoke-Release.ps1'
4 changes: 2 additions & 2 deletions docs/samples/ci/github/github-workflows.linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
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'
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./PSRepositoryReleaseManager/Invoke-Generate.ps1'
cat PSRepositoryReleaseManager/.release-notes.md
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -58,4 +58,4 @@ jobs:
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'
pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = "Continue"; ./PSRepositoryReleaseManager/Invoke-Release.ps1'
22 changes: 11 additions & 11 deletions src/PSRepositoryReleaseManager/PSRepositoryReleaseManager.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,71 +11,71 @@ Describe "PSRepositoryReleaseManager" -Tag 'Integration' {
AfterEach {
}
It "Runs Invoke-Generate.ps1" {
$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:PROJECT_DIRECTORY" {
$env:PROJECT_DIRECTORY = "$(git rev-parse --show-toplevel)"

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_TAG_REF='HEAD'" {
$env:RELEASE_TAG_REF = 'HEAD'

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_TAG_REF='branch'" {
$env:RELEASE_TAG_REF = 'master'
git checkout -b 'master' 'HEAD'

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_TAG_REF='vx.x.x'" {
$env:RELEASE_TAG_REF = git describe --tags --abbrev=0

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_TAG_REF='remote/branch'" {
$env:RELEASE_TAG_REF = 'origin/master'

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_TAG_REF='commit-hash'" {
$env:RELEASE_TAG_REF = git rev-parse HEAD

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_NOTES_VARIANT='Changes-HashSubject-NoMerges'" {
$env:RELEASE_NOTES_VARIANT = 'Changes-HashSubject-NoMerges'

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_NOTES_PATH='.release-notes.md'" {
$env:RELEASE_NOTES_PATH = ".release-notes.relativepath.md"

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
It "Runs Invoke-Generate.ps1 with `$env:RELEASE_NOTES_PATH='/path/to/.release-notes.md'" {
$env:RELEASE_NOTES_PATH = "$(git rev-parse --show-toplevel)/.release-notes.fullpath.md"

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
Expand All @@ -88,7 +88,7 @@ Describe "PSRepositoryReleaseManager" -Tag 'Integration' {
$env:RELEASE_NOTES_VARIANT = $variant
$env:RELEASE_NOTES_PATH = "$(git rev-parse --show-toplevel)/.release-notes.$variant.md"

$stdout = ../src/scripts/ci/Invoke-Generate.ps1
$stdout = ../Invoke-Generate.ps1
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Write-Host
}
Expand Down
8 changes: 4 additions & 4 deletions .vscode/tasks.json → tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,25 @@
{
"label": "Generate release notes (pwsh)",
"type": "shell",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./src/scripts/ci/Invoke-Generate.ps1'",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./Invoke-Generate.ps1'",
"group": "build"
},
{
"label": "Generate release notes (powershell)",
"type": "shell",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./src/scripts/ci/Invoke-Generate.ps1'",
"command": "PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NOTES_VARIANT='${input:RELEASE_NOTES_VARIANT}' RELEASE_NOTES_PATH='${input:RELEASE_NOTES_PATH}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./Invoke-Generate.ps1'",
"group": "build"
},
{
"label": "Create release (pwsh)",
"type": "shell",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./src/scripts/ci/Invoke-Release.ps1'",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' pwsh -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./Invoke-Release.ps1'",
"group": "build"
},
{
"label": "Create release (powershell)",
"type": "shell",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./src/scripts/ci/Invoke-Release.ps1'",
"command": "GITHUB_API_TOKEN='${input:GITHUB_API_TOKEN}' PROJECT_DIRECTORY='${input:PROJECT_DIRECTORY}' RELEASE_TAG_REF='${input:RELEASE_TAG_REF}' RELEASE_NAMESPACE='${input:RELEASE_NAMESPACE}' RELEASE_REPOSITORY='${input:RELEASE_REPOSITORY}' RELEASE_NAME='${input:RELEASE_NAME}' RELEASE_DRAFT='${input:RELEASE_DRAFT}' RELEASE_PRERELEASE='${input:RELEASE_PRERELEASE}' RELEASE_ASSETS='${input:RELEASE_ASSETS}' powershell -NoLogo -NonInteractive -NoProfile -Command '$VerbosePreference = \"Continue\"; ./Invoke-Release.ps1'",
"group": "build"
},
{
Expand Down

0 comments on commit b4f74f4

Please sign in to comment.