Skip to content

Commit

Permalink
Merge pull request #215 from StartAutomating/Irregular-Docker
Browse files Browse the repository at this point in the history
Irregular 0.7.9
  • Loading branch information
StartAutomating authored Apr 16, 2024
2 parents 8bf56ed + fd16352 commit e5faf87
Show file tree
Hide file tree
Showing 57 changed files with 483 additions and 1,495 deletions.
91 changes: 65 additions & 26 deletions .github/workflows/IrregularTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,32 +379,34 @@ jobs:
if ($releaseExists) {
"::warning::Release '$($releaseExists.Name )' Already Exists" | Out-Host
return
$releasedIt = $releaseExists
} else {
$releasedIt = Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
[Ordered]@{
owner = '${{github.owner}}'
repo = '${{github.repository}}'
tag_name = $targetVersion
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
body =
if ($env:RELEASENOTES) {
$env:RELEASENOTES
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
$imported.PrivateData.PSData.ReleaseNotes
} else {
"$($imported.Name) $targetVersion"
}
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
} | ConvertTo-Json
) -Headers @{
"Accept" = "application/vnd.github.v3+json"
"Content-type" = "application/json"
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
}
}
$releasedIt = Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
[Ordered]@{
owner = '${{github.owner}}'
repo = '${{github.repository}}'
tag_name = $targetVersion
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
body =
if ($env:RELEASENOTES) {
$env:RELEASENOTES
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
$imported.PrivateData.PSData.ReleaseNotes
} else {
"$($imported.Name) $targetVersion"
}
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
} | ConvertTo-Json
) -Headers @{
"Accept" = "application/vnd.github.v3+json"
"Content-type" = "application/json"
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
}
if (-not $releasedIt) {
Expand Down Expand Up @@ -439,10 +441,9 @@ jobs:
$fileBytes = [IO.File]::ReadAllBytes($file.FullName)
$releasedFiles[$file.Name] =
Invoke-RestMethod -Uri "${releaseUploadUrl}?name=$($file.Name)" -Headers @{
"Accept" = "application/vnd.github+json"
"ContentType" = "application/octet-stream"
"Accept" = "application/vnd.github+json"
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
} -Body $fileBytes
} -Body $fileBytes -ContentType Application/octet-stream
$releasedFiles[$file.Name]
}
}
Expand Down Expand Up @@ -583,6 +584,44 @@ jobs:
uses: StartAutomating/EZOut@master
- name: UseHelpOut
uses: StartAutomating/HelpOut@master
- name: Log in to ghcr.io
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker Metadata (for branch)
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
id: meta
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Extract Docker Metadata (for main)
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
id: metaMain
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=true
- name: Build and push Docker image (from main)
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
uses: docker/build-push-action@master
with:
context: .
push: true
tags: ${{ steps.metaMain.outputs.tags }}
labels: ${{ steps.metaMain.outputs.labels }}
- name: Build and push Docker image (from branch)
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
uses: docker/build-push-action@master
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
on:
push:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
File renamed without changes.
69 changes: 69 additions & 0 deletions Build/GitHub/Jobs/BuildIrregular.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@{
"runs-on" = "ubuntu-latest"
if = '${{ success() }}'
steps = @(
@{
name = 'Check out repository'
uses = 'actions/checkout@v2'
},
@{
name = 'Use PSSVG Action'
uses = 'StartAutomating/PSSVG@main'
id = 'PSSVG'
},
'UseIrregularAction',
'RunPipeScript',
'RunEZOut',
'RunHelpOut',
@{
'name'='Log in to ghcr.io'
'uses'='docker/login-action@master'
'with'=@{
'registry'='${{ env.REGISTRY }}'
'username'='${{ github.actor }}'
'password'='${{ secrets.GITHUB_TOKEN }}'
}
},
@{
name = 'Extract Docker Metadata (for branch)'
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
id = 'meta'
uses = 'docker/metadata-action@master'
with = @{
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
}
},
@{
name = 'Extract Docker Metadata (for main)'
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
id = 'metaMain'
uses = 'docker/metadata-action@master'
with = @{
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
'flavor'='latest=true'
}
},
@{
name = 'Build and push Docker image (from main)'
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
uses = 'docker/build-push-action@master'
with = @{
'context'='.'
'push'='true'
'tags'='${{ steps.metaMain.outputs.tags }}'
'labels'='${{ steps.metaMain.outputs.labels }}'
}
},
@{
name = 'Build and push Docker image (from branch)'
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
uses = 'docker/build-push-action@master'
with = @{
'context'='.'
'push'='true'
'tags'='${{ steps.meta.outputs.tags }}'
'labels'='${{ steps.meta.outputs.labels }}'
}
}
)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions Build/Irregular.ADOPipeline.PSDevOps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#requires -Modules PSDevOps

Push-Location ($PSScriptRoot | Split-Path)

New-ADOPipeline -Stage PowerShellStaticAnalysis, TestPowerShellCrossPlatform, UpdatePowerShellGallery |
Set-Content .\azure-pipelines.yml -Encoding UTF8

Pop-Location
12 changes: 12 additions & 0 deletions Build/Irregular.GitHubAction.PSDevops.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#requires -Module Irregular
#requires -Module PSDevOps

Import-BuildStep -SourcePath (
Join-Path $PSScriptRoot 'GitHub'
) -BuildSystem GitHubAction

Push-Location ($PSScriptRoot | Split-Path)

New-GitHubAction -Name "UseIrregular" -Description 'Regular Expressions Made Strangle Simple' -Action Irregular -Icon cpu -OutputPath .\action.yml

Pop-Location
23 changes: 23 additions & 0 deletions Build/Irregular.GitHubWorkflow.PSDevops.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#requires -Module PSDevOps
Push-Location ($PSScriptRoot | Split-Path)

Import-BuildStep -SourcePath (
Join-Path $PSScriptRoot 'GitHub'
) -BuildSystem GitHubWorkflow


New-GitHubWorkflow -Name "Test, Tag, Release, and Publish" -Job PowerShellStaticAnalysis,
TestPowerShellOnLinux,
TagReleaseAndPublish,
BuildIrregular -On Push, Demand -Environment ([Ordered]@{
REGISTRY = 'ghcr.io'
IMAGE_NAME = '${{ github.repository }}'
}) -OutputPath .\.github\workflows\IrregularTests.yml

New-GitHubWorkflow -Name "Run GitHub Action" -On Push,
Demand -Job UseIrregularAction -OutputPath .\.github\workflows\RunIrregularAction.yml

New-GitHubWorkflow -On Demand -Job RunGitPub -Name "GitPub" -OutputPath .\.github\workflows\RunGitPub.yml


Pop-Location
4 changes: 4 additions & 0 deletions Irregular.HelpOut.ps1 → Build/Irregular.HelpOut.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Push-Location ($PSScriptRoot | Split-Path)

$IrregularLoaded = Get-Module Irregular
if (-not $IrregularLoaded) {
$IrregularLoaded = Get-ChildItem -Recurse -Filter "*.psd1" |
Expand All @@ -12,3 +14,5 @@ if ($IrregularLoaded) {
if ($IrregularLoaded) {
Save-MarkdownHelp -Module $IrregularLoaded.Name -PassThru -SkipCommandType Alias
}

Pop-Location
7 changes: 6 additions & 1 deletion Irregular.PSSVG.ps1 → Build/Irregular.PSSVG.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#requires -Module PSSVG


Push-Location ($PSScriptRoot | Split-Path)

$psChevron =
=<svg.symbol> -Id psChevron -Content @(
=<svg.polygon> -Points (@(
Expand All @@ -13,7 +16,7 @@ $psChevron =
) -ViewBox 100, 100 -PreserveAspectRatio $false


$assetsPath = Join-Path $PSScriptRoot assets
$assetsPath = Join-Path $pwd assets

=<svg> -ViewBox 300, 100 @(
$psChevron
Expand All @@ -26,3 +29,5 @@ $assetsPath = Join-Path $PSScriptRoot assets
) -FontFamily 'sans-serif' -Fill '#4488ff' -FontSize 36
) -OutputPath (Join-Path $assetsPath Irregular.svg)


Pop-Location
4 changes: 2 additions & 2 deletions Irregular.ezformat.ps1 → Build/Irregular.ezformat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Install-Module EZOut or https://github.com/StartAutomating/EZOut
$myFile = $MyInvocation.MyCommand.ScriptBlock.File
$myModuleName = 'Irregular'
$myRoot = $myFile | Split-Path
$myRoot = $myFile | Split-Path | Split-Path
Push-Location $myRoot
$formatting = @(
# Add your own Write-FormatView here,
# or put them in a Formatting or Views directory
foreach ($potentialDirectory in 'Formatting','Views') {
foreach ($potentialDirectory in 'Formatting','Views', 'Types') {
Join-Path $myRoot $potentialDirectory |
Get-ChildItem -ea ignore |
Import-FormatView -FilePath {$_.Fullname}
Expand Down
Loading

0 comments on commit e5faf87

Please sign in to comment.