Skip to content

Commit

Permalink
Rename master to main and fix gitversion (#113) [release]
Browse files Browse the repository at this point in the history
* Update assembly info

* Remove next-version from GitVersion.yml

* Trigger Netlify

* Drop v2 when referencing docusaurus

* Remove more v2 references

* More v2

* Fix repo pointer for devblackops psscriptanalyser

* Start supporting gitversion merge messages
  • Loading branch information
bravo-kernel authored Jun 24, 2022
1 parent 72556a0 commit 55f505d
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 54 deletions.
6 changes: 6 additions & 0 deletions .github/actions/bump-main/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Bump Main

Github Action that:

1. replaces module manifest on main repo with bumped module manifest inside the newly built PowerShell module (artifact)
2. then creates a commit and pushes it to main using the [no-release] commit message to prevent an endless CI/CD loop
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<#
.SYNOPSIS
Replaces module manifest on master with bumped manifest in the artifact, then creates the commit.
Replaces module manifest on main with bumped manifest in the artifact, then creates the commit.
.PARAMETER ArtifactFolder
Path to the artifact holding the newly built module (e.g. Modules/Alt3.Docusaurus.PowerShell)
.PARAMETER MasterFolder
Path to the master repo (e.g. __master)
.PARAMETER MainFolder
Path to the main repo (e.g. __main)
#>
[cmdletbinding()]
Param(
[Parameter(Mandatory=$true)][string]$ArtifactFolder,
[Parameter(Mandatory=$true)][string]$MasterFolder
[Parameter(Mandatory=$true)][string]$MainFolder
)

# prepare variables
Write-Output "========================================================================================================================"
Write-Output "=> artifact folder = $ArtifactFolder"
Write-Output "=> master folder = $MasterFolder"
Write-Output "=> main folder = $MainFolder"

$moduleName = $env:MODULE_NAME
Write-Output "=> module name = $moduleName"
Expand All @@ -28,24 +28,24 @@ Write-Output "=> artifact version = $moduleName"
$artifactManifestPath = Join-Path $ArtifactFolder -ChildPath $artifactVersion | Join-Path -ChildPath "$moduleName.psd1"
Write-Output "=> artifact manifest = $artifactManifestPath"

$masterManifestPath = Join-Path $MasterFolder -ChildPath "Source" | Join-Path -ChildPath "$moduleName.psd1"
Write-Output "=> master manifest = $masterManifestPath"
$mainManifestPath = Join-Path $MainFolder -ChildPath "Source" | Join-Path -ChildPath "$moduleName.psd1"
Write-Output "=> main manifest = $mainManifestPath"

$commitMessage = "Bump manifest to $artifactVersion"
Write-Output "=> commit message = $commitMessage"

$artifactManifest = Get-Item -Path $artifactManifestPath -Verbose
$masterManifest = Get-Item -Path $masterManifestPath -Verbose
$mainManifest = Get-Item -Path $mainManifestPath -Verbose

Write-Output "========================================================================================================================"
Write-Output "Replacing manifest on master:"
Copy-Item -Path $artifactManifest -Destination $masterManifest -Force -Verbose
Write-Output "Updated manifest on master:"
Get-Content -Path $masterManifest.FullName
Write-Output "Replacing manifest on main:"
Copy-Item -Path $artifactManifest -Destination $mainManifest -Force -Verbose
Write-Output "Updated manifest on main:"
Get-Content -Path $mainManifest.FullName

Write-Output "========================================================================================================================"
Write-Output "Switch working directory"
Set-Location $MasterFolder -Verbose
Set-Location $MainFolder -Verbose

Write-Output "========================================================================================================================"
Write-Output "Preparing Git commit:"
Expand All @@ -71,10 +71,10 @@ git status

Write-Output "========================================================================================================================"
Write-Output "Git commit:"
git add $masterManifest.FullName
git add $mainManifest.FullName
git commit -m $commitMessage
git status

Write-Output "========================================================================================================================"
Write-Output "Git push:"
git push origin master --quiet
git push origin main --quiet
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Bump Module Manifest Version
description: "Replaces module manifest on master with bumped version, then commits the change to master"
description: "Replaces module manifest on main with bumped version, then commits the change to main"

inputs:
artifactPath:
Expand All @@ -9,13 +9,13 @@ inputs:
runs:
using: composite
steps:
- name: Checkout Master
- name: Checkout Main
uses: actions/checkout@v2
with:
path: __master
ref: master
path: __main
ref: main
fetch-depth: 0 # fetch history for all tags and branches

- name: Bump Module Manifest
shell: pwsh
run: ${{ github.action_path }}/action.ps1 -ArtifactFolder ${{ inputs.artifactPath }} -MasterFolder __master
run: ${{ github.action_path }}/action.ps1 -ArtifactFolder ${{ inputs.artifactPath }} -MainFolder __main
6 changes: 0 additions & 6 deletions .github/actions/bump-master/README.md

This file was deleted.

18 changes: 9 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Build
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

env:
MODULE_NAME: Alt3.Docusaurus.PowerShell
Expand Down Expand Up @@ -112,18 +112,18 @@ jobs:

# -----------------------------------------------------------------------------
# Publishing stage:
# - is skipped completely UNLESS on the master branch
# - is skipped completely UNLESS on the main branch
# - is skipped completely UNLESS the commit message contains "[release]"
# - the psgallery published manifest already contains the bumped module version
# - the bump-master step bumps copies the artifact manifest to master to match
# - the bump-main step bumps copies the artifact manifest to main to match
# the PSGallery-published version (without adding [release] to the commit
# message)
# -----------------------------------------------------------------------------
publish:
name: Publish
runs-on: windows-latest
needs: [lint, test]
if: ${{ github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')}}
if: ${{ github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, '[release]')}}

steps:
- name: Checkout
Expand Down Expand Up @@ -152,9 +152,9 @@ jobs:
with:
modulePath: Modules/${{env.MODULE_NAME}}

- name: Bump Manifest Version on Master
id: bumpMaster
uses: ./.github/actions/bump-master
- name: Bump Manifest Version on Main
id: bumpMain
uses: ./.github/actions/bump-main
with:
artifactPath: Modules/${{env.MODULE_NAME}}

Expand All @@ -163,7 +163,7 @@ jobs:
with:
name: Release ${{ steps.gitversion.outputs.LegacySemVerPadded }}
tag_name: ${{ env.GitVersion_LegacySemVerPadded }}
target_commitish: master
target_commitish: main
draft: false
prerelease: false
generate_release_notes: true
13 changes: 8 additions & 5 deletions GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ mode: Mainline
commit-message-incrementing: MergeMessageOnly
assembly-versioning-format: '{Major}.{Minor}.{Patch}.{env:BUILDCOUNT ?? 0}'
assembly-informational-format: '{NuGetVersionV2}+Build.{env:BUILDCOUNT ?? 0}.Date.{CommitDate}.Branch.{env:SAFEBRANCHNAME ?? unknown}.Sha.{Sha}'
next-version: 1.0.0
major-version-bump-message: '\+?semver:\s?(breaking|major)'
minor-version-bump-message: '\+?semver:\s?(feature|minor)'
patch-version-bump-message: '\+?semver:\s?(fix|patch)'
no-bump-message: '\+?semver:\s?(none|skip)'
branches:
master:
main:
increment: Patch
pull-request:
tag: rc
increment: Patch
features:
feature:
increment: Patch
regex: .*?/
source-branches:
- master
- features
- main
- feature
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Documentation websites for PowerShell Modules (with auto-generated Get-Help page
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://pester.dev/"><img src="https://raw.githubusercontent.com/pester/Pester/master/images/logo.png" width="100px;" alt=""/><br /><h3>Pester</h3></td>
<td align="center"><a href="https://pester.dev/"><img src="https://raw.githubusercontent.com/pester/Pester/main/images/logo.png" width="100px;" alt=""/><br /><h3>Pester</h3></td>
</tr>
</table>

Expand All @@ -37,4 +37,4 @@ PowerShell 7, Pester 4:

> **Important:** after code changes, make sure to build-and-import the Alt3 module before running Pester!
> Pester 5 coming soon
> Pester 5 coming soon!
2 changes: 1 addition & 1 deletion Source/Alt3.Docusaurus.PowerShell.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Live demo at https://docusaurus-powershell.netlify.app/
ProjectUri = 'https://www.github.com/alt3/Docusaurus.PowerShell'

# A URL to the license for this module.
LicenseUri = 'https://github.com/alt3/Docusaurus.PowerShell/blob/master/LICENSE.txt'
LicenseUri = 'https://github.com/alt3/Docusaurus.PowerShell/blob/main/LICENSE.txt'

# Tags applied to this module. These help with module discovery in online galleries.
Tags = @(
Expand Down
2 changes: 1 addition & 1 deletion Source/Public/New-DocusaurusHelp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function New-DocusaurusHelp() {
https://docusaurus-powershell.netlify.app/
.LINK
https://v2.docusaurus.io/
https://docusaurus.io/
.LINK
https://github.com/PowerShell/platyPS
Expand Down
4 changes: 2 additions & 2 deletions website/docs/commands/New-DocusaurusHelp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords:
- PowerShell
hide_title: false
hide_table_of_contents: false
custom_edit_url: https://github.com/alt3/Docusaurus.PowerShell/edit/master/Source/Public/New-DocusaurusHelp.ps1
custom_edit_url: https://github.com/alt3/Docusaurus.PowerShell/edit/main/Source/Public/New-DocusaurusHelp.ps1
---

## SYNOPSIS
Expand Down Expand Up @@ -376,7 +376,7 @@ $tempFolder = Get-Item (Join-Path -Path ([System.IO.Path]::GetTempPath()) -Child

[https://docusaurus-powershell.netlify.app/](https://docusaurus-powershell.netlify.app/)

[https://v2.docusaurus.io/](https://v2.docusaurus.io/)
[https://docusaurus.io/](https://docusaurus.io/)

[https://github.com/PowerShell/platyPS](https://github.com/PowerShell/platyPS)

Expand Down
4 changes: 2 additions & 2 deletions website/docs/faq/multi-line-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Code fencing ensures identical rendering across all PowerShell versions and look
- \`\`\`powershell

> For a full list of usage examples see
> [this test module](https://github.com/alt3/Docusaurus.PowerShell/blob/master/Tests/Integration/CrossVersionCodeExamples.psm1)
> and [the markdown](https://github.com/alt3/Docusaurus.PowerShell/blob/master/Tests/Integration/CrossVersionCodeExamples.expected.mdx)
> [this test module](https://github.com/alt3/Docusaurus.PowerShell/blob/main/Tests/Integration/CrossVersionCodeExamples.psm1)
> and [the markdown](https://github.com/alt3/Docusaurus.PowerShell/blob/main/Tests/Integration/CrossVersionCodeExamples.expected.mdx)
> it renders.
## PowerShell 7 Native Multi-Lines
Expand Down
2 changes: 1 addition & 1 deletion website/docs/faq/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ However, by default, the Docusaurus searchbar will not be available for your web
To enable search:

1. [apply for the Algolia DocSearch service](https://community.algolia.com/docsearch/)
2. [update your Docusaurus configuration file](https://v2.docusaurus.io/docs/search/#connecting-algolia)
2. [update your Docusaurus configuration file](https://docusaurus.io/docs/search/#connecting-algolia)
2 changes: 1 addition & 1 deletion website/docs/faq/vendor-agnostic.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The Docusaurus-specific `docusaurus.sidebar.js` file will not be generated.

If your solution/vendor requires a similar list you will need to generate one yourself,
perhaps using the
[NewSideBarIncludeFile](https://github.com/alt3/Docusaurus.PowerShell/blob/master/Source/Private/NewSidebarIncludeFile.ps1)
[NewSideBarIncludeFile](https://github.com/alt3/Docusaurus.PowerShell/blob/main/Source/Private/NewSidebarIncludeFile.ps1)
function for inspiration.

## Additional Information
Expand Down
4 changes: 2 additions & 2 deletions website/docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This project was created to help you document and showcase your PowerShell Modul
Instead of reinventing the wheel and failing in an area where PowerShell does not excel
(frontend development), this project provides a bridge between your
[PowerShell Comment-Based Help](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help?view=powershell-6)
and [Docusaurus v2](https://v2.docusaurus.io/), a static website generator written
and [Docusaurus](https://docusaurus.io/), a static website generator written
in React, with an empahasis on ease-of-use.

This cross-technology approach allows you to focus on documenting your modules without having
Expand All @@ -33,7 +33,7 @@ of advanced features like Get-Help Code Fence Detection.

## Early Bird

Just like Docusaurus v2, this module is still in it's early stages.
Just like Docusaurus, this module is still in it's early stages.
Features are deliberately kept to a minimum so we can make
things work first, then make it better.

Expand Down
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = {
docs: {
path: 'docs',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/alt3/Docusaurus.PowerShell/edit/master/docusaurus',
editUrl: 'https://github.com/alt3/Docusaurus.PowerShell/edit/main/docusaurus',
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
Expand Down
2 changes: 1 addition & 1 deletion website/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

/**
* Theme override for Docusaurus.PowerShell as explained at
* https://v2.docusaurus.io/docs/styling-layout
* https://docusaurus.io/docs/styling-layout
*/
#hero-get-started {
margin-top: 10px;
Expand Down

0 comments on commit 55f505d

Please sign in to comment.