Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 10 additions & 0 deletions .cspell.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"words": [
"anypackage",
"Authenticode",
"LASTEXITCODE",
"Nieto",
"SARIF",
"trunc"
]
}
132 changes: 132 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: CI

defaults:
run:
shell: pwsh

on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

release:
types: [ published ]

jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Upload module
uses: actions/upload-artifact@v4
with:
name: module
path: ./src/

Test:
needs: Build
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install AnyPackage
run: Install-Module AnyPackage -Force -AllowClobber

- name: Download module
uses: actions/download-artifact@v4
with:
name: module
path: AnyPackage.Docker

- name: Move module
run: |
if ($IsWindows) {
$path = "$HOME\Documents\PowerShell\Modules"
} else {
$path = "$HOME/.local/share/powershell/Modules"
}

Move-Item AnyPackage.Docker $path

- name: Test with Pester
run: |
$ht = Import-PowerShellDataFile PesterSettings.psd1
$config = New-PesterConfiguration $ht
Invoke-Pester -Configuration $config

Sign:
needs: Test
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Download module
uses: actions/download-artifact@v4
with:
name: module
path: module

- name: Import certificate
env:
CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
CERTIFICATE_PASSWORD_KEY_BASE64: ${{ secrets.CERTIFICATE_PASSWORD_KEY_BASE64 }}
run: |
[convert]::FromBase64String($env:CERTIFICATE_BASE64) | Set-Content -Path cert.pfx -AsByteStream
$key = [convert]::FromBase64String($env:CERTIFICATE_PASSWORD_KEY_BASE64)
$password = ConvertTo-SecureString $env:CERTIFICATE_PASSWORD -Key $key
Import-PfxCertificate cert.pfx -Password $password -CertStoreLocation Cert:\CurrentUser\My

- name: Sign files
run: |
$config = Import-PowerShellDataFile SignSettings.psd1
$config['Certificate'] = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert
Set-Location .\module
Set-AuthenticodeSignature @config

- name: Create and sign catalog file
run: |
$config = Import-PowerShellDataFile SignSettings.psd1
$config['FilePath'] = 'AnyPackage.Docker.cat'
$config['Certificate'] = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert
Set-Location .\module
New-FileCatalog $config['FilePath'] -CatalogVersion 2
Set-AuthenticodeSignature @config

- name: Upload module
uses: actions/upload-artifact@v4
with:
name: module-signed
path: ./module/

Publish:
needs: Sign
if: github.event_name == 'release' && github.event.action == 'published'
runs-on: ubuntu-latest
steps:

- name: Download module
uses: actions/download-artifact@v4
with:
name: module-signed
path: '~/.local/share/powershell/Modules/AnyPackage.Docker'

- name: Install AnyPackage
run: Install-Module AnyPackage -Force -AllowClobber

- name: Publish Module
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
run: |
$module = Get-Module AnyPackage.Docker -ListAvailable
Publish-PSResource $module.ModuleBase -ApiKey $env:NUGET_KEY
43 changes: 43 additions & 0 deletions .github/workflows/lint-powershell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PSScriptAnalyzer

defaults:
run:
shell: pwsh

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '22 1 * * 3'

permissions:
contents: read

jobs:
build:
permissions:
contents: read
security-events: write
name: PSScriptAnalyzer
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install AnyPackage
run: Install-Module AnyPackage -Force -AllowClobber

- name: Install ConvertToSARIF
run: Install-Module ConvertToSARIF -Force

- name: Run PSScriptAnalyzer
run: |
Import-Module AnyPackage, ConvertToSARIF -PassThru
Invoke-ScriptAnalyzer -Path . -Recurse | ConvertTo-SARIF -FilePath results.sarif

- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
54 changes: 54 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"code-block-style": {
"style": "fenced"
},
"code-fence-style": {
"style": "backtick"
},
"emphasis-style": {
"style": "asterisk"
},
"fenced-code-language": {
"allowed_languages": [
"powershell",
"text"
],
"language_only": true
},
"heading-style": {
"style": "atx"
},
"hr-style": {
"style": "---"
},
"line-length": {
"strict": true,
"code_blocks": false
},
"link-image-style": {
"collapsed": false,
"url_inline": false
},
"no-duplicate-heading": {
"siblings_only": true
},
"ol-prefix": {
"style": "ordered"
},
"proper-names": {
"code_blocks": false,
"names": [
"PowerShell",
"AnyPackage"
]
},
"reference-links-images": {
"shortcut_syntax": true
},
"strong-style": {
"style": "asterisk"
},
"ul-style": {
"style": "dash"
}
}
8 changes: 8 additions & 0 deletions PesterSettings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@{
Run = @{
Exit = $true
}
Output = @{
Verbosity = 'Detailed'
}
}
5 changes: 5 additions & 0 deletions SignSettings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@{
FilePath = @('AnyPackage.Docker.psd1', 'AnyPackage.Docker.psm1')
TimeStampServer = 'http://timestamp.sectigo.com'
HashAlgorithm = 'SHA256'
}
24 changes: 24 additions & 0 deletions src/AnyPackage.Docker.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@{
RootModule = 'AnyPackage.Docker.psm1'
ModuleVersion = '0.1.0'
CompatiblePSEditions = @('Desktop', 'Core')
GUID = '4826c4eb-b455-434e-9d1f-253c9e0021fd'
Author = 'Thomas Nieto'
Copyright = '(c) 2025 Thomas Nieto. All rights reserved.'
Description = 'Docker provider for AnyPackage.'
PowerShellVersion = '5.1'
RequiredModules = @('AnyPackage')
FunctionsToExport = @()
CmdletsToExport = @()
AliasesToExport = @()
PrivateData = @{
AnyPackage = @{
Providers = 'Docker'
}
PSData = @{
Tags = @('AnyPackage', 'Provider', 'Docker', 'Container', 'Windows', 'Linux', 'MacOS')
LicenseUri = 'https://github.com/anypackage/docker/blob/main/LICENSE'
ProjectUri = 'https://github.com/anypackage/docker'
}
}
}
Loading