Skip to content

Commit c8161cd

Browse files
author
James Brundage
committed
1 parent 479987f commit c8161cd

3 files changed

Lines changed: 102 additions & 7 deletions

File tree

.github/workflows/BuildAndPublishPosh.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,49 @@ jobs:
506506
id: EZOut
507507
- name: UseHelpOut
508508
uses: StartAutomating/HelpOut@master
509+
- name: PSA
510+
uses: StartAutomating/PSA@main
511+
id: PSA
509512
- name: GitLogger
510513
uses: GitLogging/GitLoggerAction@main
511514
id: GitLogger
512-
515+
- name: Log in to ghcr.io
516+
uses: docker/login-action@master
517+
with:
518+
registry: ${{ env.REGISTRY }}
519+
username: ${{ github.actor }}
520+
password: ${{ secrets.GITHUB_TOKEN }}
521+
- name: Extract Docker Metadata (for branch)
522+
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
523+
id: meta
524+
uses: docker/metadata-action@master
525+
with:
526+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
527+
- name: Extract Docker Metadata (for main)
528+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
529+
id: metaMain
530+
uses: docker/metadata-action@master
531+
with:
532+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
533+
flavor: latest=true
534+
- name: Build and push Docker image (from main)
535+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
536+
uses: docker/build-push-action@master
537+
with:
538+
context: .
539+
push: true
540+
tags: ${{ steps.metaMain.outputs.tags }}
541+
labels: ${{ steps.metaMain.outputs.labels }}
542+
- name: Build and push Docker image (from branch)
543+
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
544+
uses: docker/build-push-action@master
545+
with:
546+
context: .
547+
push: true
548+
tags: ${{ steps.meta.outputs.tags }}
549+
labels: ${{ steps.meta.outputs.labels }}
550+
env:
551+
AT_PROTOCOL_HANDLE: mrpowershell.bsky.social
552+
AT_PROTOCOL_APP_PASSWORD: ${{ secrets.AT_PROTOCOL_APP_PASSWORD }}
553+
REGISTRY: ghcr.io
554+
IMAGE_NAME: ${{ github.repository }}

Build/GitHub/Jobs/BuildPosh.psd1

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,64 @@
2424
}
2525
'RunHelpOut',
2626
@{
27-
name = 'GitLogger'
28-
uses = 'GitLogging/GitLoggerAction@main'
29-
id = 'GitLogger'
30-
},@{
3127
name = 'PSA'
3228
uses = 'StartAutomating/PSA@main'
3329
id = 'PSA'
30+
},
31+
@{
32+
name = 'GitLogger'
33+
uses = 'GitLogging/GitLoggerAction@main'
34+
id = 'GitLogger'
35+
},
36+
@{
37+
'name'='Log in to ghcr.io'
38+
'uses'='docker/login-action@master'
39+
'with'=@{
40+
'registry'='${{ env.REGISTRY }}'
41+
'username'='${{ github.actor }}'
42+
'password'='${{ secrets.GITHUB_TOKEN }}'
43+
}
44+
},
45+
@{
46+
name = 'Extract Docker Metadata (for branch)'
47+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
48+
id = 'meta'
49+
uses = 'docker/metadata-action@master'
50+
with = @{
51+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
52+
}
53+
},
54+
@{
55+
name = 'Extract Docker Metadata (for main)'
56+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
57+
id = 'metaMain'
58+
uses = 'docker/metadata-action@master'
59+
with = @{
60+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
61+
'flavor'='latest=true'
62+
}
63+
},
64+
@{
65+
name = 'Build and push Docker image (from main)'
66+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
67+
uses = 'docker/build-push-action@master'
68+
with = @{
69+
'context'='.'
70+
'push'='true'
71+
'tags'='${{ steps.metaMain.outputs.tags }}'
72+
'labels'='${{ steps.metaMain.outputs.labels }}'
73+
}
74+
},
75+
@{
76+
name = 'Build and push Docker image (from branch)'
77+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
78+
uses = 'docker/build-push-action@master'
79+
with = @{
80+
'context'='.'
81+
'push'='true'
82+
'tags'='${{ steps.meta.outputs.tags }}'
83+
'labels'='${{ steps.meta.outputs.labels }}'
84+
}
3485
}
3586
)
3687
}

Build/Posh.GitHubWorkflow.PSDevOps.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ New-GitHubWorkflow -Name "Build and Publish Posh" -On Demand, Push -Job TagRelea
99
TestPowerShellOnLinux,
1010
BuildPosh -OutputPath (
1111
Join-Path $pwd .\.github\workflows\BuildAndPublishPosh.yml
12-
) -Env @{
12+
) -Env ([Ordered]@{
1313
"AT_PROTOCOL_HANDLE" = "mrpowershell.bsky.social"
1414
"AT_PROTOCOL_APP_PASSWORD" = '${{ secrets.AT_PROTOCOL_APP_PASSWORD }}'
15-
}
15+
"REGISTRY" = "ghcr.io"
16+
"IMAGE_NAME" = '${{ github.repository }}'
17+
})
1618

1719
Pop-Location

0 commit comments

Comments
 (0)