Skip to content

Commit e5faf87

Browse files
Merge pull request #215 from StartAutomating/Irregular-Docker
Irregular 0.7.9
2 parents 8bf56ed + fd16352 commit e5faf87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+483
-1495
lines changed

.github/workflows/IrregularTests.yml

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -379,32 +379,34 @@ jobs:
379379
380380
if ($releaseExists) {
381381
"::warning::Release '$($releaseExists.Name )' Already Exists" | Out-Host
382-
return
382+
$releasedIt = $releaseExists
383+
} else {
384+
$releasedIt = Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
385+
[Ordered]@{
386+
owner = '${{github.owner}}'
387+
repo = '${{github.repository}}'
388+
tag_name = $targetVersion
389+
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
390+
body =
391+
if ($env:RELEASENOTES) {
392+
$env:RELEASENOTES
393+
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
394+
$imported.PrivateData.PSData.ReleaseNotes
395+
} else {
396+
"$($imported.Name) $targetVersion"
397+
}
398+
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
399+
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
400+
} | ConvertTo-Json
401+
) -Headers @{
402+
"Accept" = "application/vnd.github.v3+json"
403+
"Content-type" = "application/json"
404+
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
405+
}
383406
}
384407
385408
386-
$releasedIt = Invoke-RestMethod -Uri $releasesURL -Method Post -Body (
387-
[Ordered]@{
388-
owner = '${{github.owner}}'
389-
repo = '${{github.repository}}'
390-
tag_name = $targetVersion
391-
name = $ExecutionContext.InvokeCommand.ExpandString($ReleaseNameFormat)
392-
body =
393-
if ($env:RELEASENOTES) {
394-
$env:RELEASENOTES
395-
} elseif ($imported.PrivateData.PSData.ReleaseNotes) {
396-
$imported.PrivateData.PSData.ReleaseNotes
397-
} else {
398-
"$($imported.Name) $targetVersion"
399-
}
400-
draft = if ($env:RELEASEISDRAFT) { [bool]::Parse($env:RELEASEISDRAFT) } else { $false }
401-
prerelease = if ($env:PRERELEASE) { [bool]::Parse($env:PRERELEASE) } else { $false }
402-
} | ConvertTo-Json
403-
) -Headers @{
404-
"Accept" = "application/vnd.github.v3+json"
405-
"Content-type" = "application/json"
406-
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
407-
}
409+
408410
409411
410412
if (-not $releasedIt) {
@@ -439,10 +441,9 @@ jobs:
439441
$fileBytes = [IO.File]::ReadAllBytes($file.FullName)
440442
$releasedFiles[$file.Name] =
441443
Invoke-RestMethod -Uri "${releaseUploadUrl}?name=$($file.Name)" -Headers @{
442-
"Accept" = "application/vnd.github+json"
443-
"ContentType" = "application/octet-stream"
444+
"Accept" = "application/vnd.github+json"
444445
"Authorization" = 'Bearer ${{ secrets.GITHUB_TOKEN }}'
445-
} -Body $fileBytes
446+
} -Body $fileBytes -ContentType Application/octet-stream
446447
$releasedFiles[$file.Name]
447448
}
448449
}
@@ -583,6 +584,44 @@ jobs:
583584
uses: StartAutomating/EZOut@master
584585
- name: UseHelpOut
585586
uses: StartAutomating/HelpOut@master
587+
- name: Log in to ghcr.io
588+
uses: docker/login-action@master
589+
with:
590+
registry: ${{ env.REGISTRY }}
591+
username: ${{ github.actor }}
592+
password: ${{ secrets.GITHUB_TOKEN }}
593+
- name: Extract Docker Metadata (for branch)
594+
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
595+
id: meta
596+
uses: docker/metadata-action@master
597+
with:
598+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
599+
- name: Extract Docker Metadata (for main)
600+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
601+
id: metaMain
602+
uses: docker/metadata-action@master
603+
with:
604+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
605+
flavor: latest=true
606+
- name: Build and push Docker image (from main)
607+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
608+
uses: docker/build-push-action@master
609+
with:
610+
context: .
611+
push: true
612+
tags: ${{ steps.metaMain.outputs.tags }}
613+
labels: ${{ steps.metaMain.outputs.labels }}
614+
- name: Build and push Docker image (from branch)
615+
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
616+
uses: docker/build-push-action@master
617+
with:
618+
context: .
619+
push: true
620+
tags: ${{ steps.meta.outputs.tags }}
621+
labels: ${{ steps.meta.outputs.labels }}
586622
on:
587623
push:
588624
workflow_dispatch:
625+
env:
626+
REGISTRY: ghcr.io
627+
IMAGE_NAME: ${{ github.repository }}
File renamed without changes.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
@{
2+
"runs-on" = "ubuntu-latest"
3+
if = '${{ success() }}'
4+
steps = @(
5+
@{
6+
name = 'Check out repository'
7+
uses = 'actions/checkout@v2'
8+
},
9+
@{
10+
name = 'Use PSSVG Action'
11+
uses = 'StartAutomating/PSSVG@main'
12+
id = 'PSSVG'
13+
},
14+
'UseIrregularAction',
15+
'RunPipeScript',
16+
'RunEZOut',
17+
'RunHelpOut',
18+
@{
19+
'name'='Log in to ghcr.io'
20+
'uses'='docker/login-action@master'
21+
'with'=@{
22+
'registry'='${{ env.REGISTRY }}'
23+
'username'='${{ github.actor }}'
24+
'password'='${{ secrets.GITHUB_TOKEN }}'
25+
}
26+
},
27+
@{
28+
name = 'Extract Docker Metadata (for branch)'
29+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
30+
id = 'meta'
31+
uses = 'docker/metadata-action@master'
32+
with = @{
33+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
34+
}
35+
},
36+
@{
37+
name = 'Extract Docker Metadata (for main)'
38+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
39+
id = 'metaMain'
40+
uses = 'docker/metadata-action@master'
41+
with = @{
42+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
43+
'flavor'='latest=true'
44+
}
45+
},
46+
@{
47+
name = 'Build and push Docker image (from main)'
48+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
49+
uses = 'docker/build-push-action@master'
50+
with = @{
51+
'context'='.'
52+
'push'='true'
53+
'tags'='${{ steps.metaMain.outputs.tags }}'
54+
'labels'='${{ steps.metaMain.outputs.labels }}'
55+
}
56+
},
57+
@{
58+
name = 'Build and push Docker image (from branch)'
59+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
60+
uses = 'docker/build-push-action@master'
61+
with = @{
62+
'context'='.'
63+
'push'='true'
64+
'tags'='${{ steps.meta.outputs.tags }}'
65+
'labels'='${{ steps.meta.outputs.labels }}'
66+
}
67+
}
68+
)
69+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#requires -Modules PSDevOps
2+
3+
Push-Location ($PSScriptRoot | Split-Path)
4+
5+
New-ADOPipeline -Stage PowerShellStaticAnalysis, TestPowerShellCrossPlatform, UpdatePowerShellGallery |
6+
Set-Content .\azure-pipelines.yml -Encoding UTF8
7+
8+
Pop-Location
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#requires -Module Irregular
2+
#requires -Module PSDevOps
3+
4+
Import-BuildStep -SourcePath (
5+
Join-Path $PSScriptRoot 'GitHub'
6+
) -BuildSystem GitHubAction
7+
8+
Push-Location ($PSScriptRoot | Split-Path)
9+
10+
New-GitHubAction -Name "UseIrregular" -Description 'Regular Expressions Made Strangle Simple' -Action Irregular -Icon cpu -OutputPath .\action.yml
11+
12+
Pop-Location
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#requires -Module PSDevOps
2+
Push-Location ($PSScriptRoot | Split-Path)
3+
4+
Import-BuildStep -SourcePath (
5+
Join-Path $PSScriptRoot 'GitHub'
6+
) -BuildSystem GitHubWorkflow
7+
8+
9+
New-GitHubWorkflow -Name "Test, Tag, Release, and Publish" -Job PowerShellStaticAnalysis,
10+
TestPowerShellOnLinux,
11+
TagReleaseAndPublish,
12+
BuildIrregular -On Push, Demand -Environment ([Ordered]@{
13+
REGISTRY = 'ghcr.io'
14+
IMAGE_NAME = '${{ github.repository }}'
15+
}) -OutputPath .\.github\workflows\IrregularTests.yml
16+
17+
New-GitHubWorkflow -Name "Run GitHub Action" -On Push,
18+
Demand -Job UseIrregularAction -OutputPath .\.github\workflows\RunIrregularAction.yml
19+
20+
New-GitHubWorkflow -On Demand -Job RunGitPub -Name "GitPub" -OutputPath .\.github\workflows\RunGitPub.yml
21+
22+
23+
Pop-Location

Irregular.HelpOut.ps1 renamed to Build/Irregular.HelpOut.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Push-Location ($PSScriptRoot | Split-Path)
2+
13
$IrregularLoaded = Get-Module Irregular
24
if (-not $IrregularLoaded) {
35
$IrregularLoaded = Get-ChildItem -Recurse -Filter "*.psd1" |
@@ -12,3 +14,5 @@ if ($IrregularLoaded) {
1214
if ($IrregularLoaded) {
1315
Save-MarkdownHelp -Module $IrregularLoaded.Name -PassThru -SkipCommandType Alias
1416
}
17+
18+
Pop-Location

0 commit comments

Comments
 (0)