Skip to content

Commit

Permalink
INitial minor version (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Feb 11, 2024
1 parent 7f1d0ed commit 6cee9f1
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
###########################
## Markdown Linter rules ##
###########################

# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint

###############
# Rules by id #
###############
MD004: false # Unordered list style
MD007:
indent: 2 # Unordered list indentation
MD013:
line_length: 808 # Line length
MD026:
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading

#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes

changelog:
categories:
- title: Breaking Changes
labels:
- Major
- Breaking
- title: New Features
labels:
- Minor
- Feature
- Improvement
- Enhancement
- title: Other Changes
labels:
- '*'
27 changes: 27 additions & 0 deletions .github/workflows/Auto-Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto-Release

on:
pull_request:
branches:
- main
types:
- closed
- opened
- reopened
- synchronize
- labeled

concurrency:
group: ${{ github.workflow }}

jobs:
Auto-Release:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Auto-Release
uses: PSModule/Auto-Release@v1
env:
GH_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
17 changes: 17 additions & 0 deletions .github/workflows/Linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Linter

on:
pull_request:

jobs:
Lint:
name: Lint code base
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Lint code base
uses: github/super-linter@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/Workflow-Test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Verify Workflow

on:
workflow_call:
push:
paths:
- workflow.yml
- .github/workflows/Workflow-Test.yml

jobs:
DefaultTest:
uses: ./.github/workflows/workflow.yml
secrets: inherit
110 changes: 110 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Process-PSModule

on:
workflow_call:
secrets:
APIKey:
description: The API key to use when publishing modules
required: true
GH_TOKEN:
description: The GitHub token to use when testing and modules
required: false
inputs:
TestModuleSkip:
type: boolean
description: Skip testing built module
required: false
default: false
TestModuleErrorAction:
type: string
description: The ErrorActionPreference to use when running tests on built module
required: false
default: Stop
TestSrcSkip:
type: boolean
description: Skip testing source code
required: false
default: false
TestSrcErrorAction:
type: string
description: The ErrorActionPreference to use when running tests on source code
required: false
default: Stop
Version:
type: string
description: The version of the PSModule.FX to use
required: false

jobs:
Get-PSModuleNames:
name: Get modules to process in repo
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Get-PSModuleNames
id: Get-PSModuleNames
shell: pwsh
run: |
# Get-PSModuleNames
Write-Output "##[group]Get-PSModuleNames"
$srcPath = (Join-Path $env:GITHUB_WORKSPACE 'src')
$moduleNames = @()
$moduleNames += Get-ChildItem -Path $srcPath -Directory | Select-Object -ExpandProperty Name
$moduleNames = $moduleNames | ConvertTo-Json -AsArray -Compress
Write-Verbose "ModuleNames=$moduleNames" -Verbose
Write-Output "ModuleNames=$moduleNames" >> $env:GITHUB_OUTPUT
Write-Output "##[endgroup]"
outputs:
ModuleNames: ${{ steps.Get-PSModuleNames.outputs.ModuleNames }}

Process-PSModule:
name: Process module
runs-on: ubuntu-latest
needs:
- Get-PSModuleNames
strategy:
fail-fast: false
matrix:
ModuleName: ${{ fromJson(needs.Get-PSModuleNames.outputs.ModuleNames) }}
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Initialize environment
uses: PSModule/Initialize-PSModule@main
with:
Version: ${{ inputs.Version }}

- name: Test source code
uses: PSModule/Test-PSModule@main
if: ${{ inputs.TestSrcSkip == false }}
with:
Name: ${{ matrix.ModuleName }}
Path: src
ErrorAction: ${{ inputs.TestSrcErrorAction }}

- name: Build module
uses: PSModule/Build-PSModule@main
with:
Name: ${{ matrix.ModuleName }}

- name: Test built module
uses: PSModule/Test-PSModule@main
if: ${{ inputs.TestModuleSkip == false }}
with:
Name: ${{ matrix.ModuleName }}
Path: outputs
ErrorAction: ${{ inputs.TestModuleErrorAction }}
CustomTestsPath: tests
env:
GH_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication

- name: Publish module
uses: PSModule/Publish-PSModule@main
with:
APIKey: ${{ secrets.APIKEY }}
Name: ${{ matrix.ModuleName }}
env:
GH_TOKEN: ${{ github.token }} # Used for GitHub CLI authentication
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# Actions
Repo for GitHub actions and workflows
# Process-PSModule

Repository for the PSModule Process-PSModule workflow template.
It stiches together the Initialize, Build, Test, and Publish workflows to create a complete CI/CD pipeline for PowerShell modules.

## Usage

To be added.

## More information about workflow templates

- [Reusing workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows)

0 comments on commit 6cee9f1

Please sign in to comment.