Skip to content

Commit 034d064

Browse files
author
James Brundage
committed
feat: PSDevOps Container Build workflow ( Fixes #202 )
1 parent 0ded3f0 commit 034d064

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

.github/workflows/TestAndPublish.yml

+40
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,46 @@ jobs:
582582
uses: StartAutomating/EZOut@master
583583
- name: UseHelpOut
584584
uses: StartAutomating/HelpOut@master
585+
- name: Log in to ghcr.io
586+
uses: docker/login-action@master
587+
with:
588+
registry: ${{ env.REGISTRY }}
589+
username: ${{ github.actor }}
590+
password: ${{ secrets.GITHUB_TOKEN }}
591+
env:
592+
REGISTRY: ghcr.io
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+
env:
600+
REGISTRY: ghcr.io
601+
IMAGE_NAME: ${{ github.repository }}
602+
- name: Extract Docker Metadata (for main)
603+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
604+
id: metaMain
605+
uses: docker/metadata-action@master
606+
with:
607+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
608+
flavor: latest=true
609+
- name: Build and push Docker image (from main)
610+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
611+
uses: docker/build-push-action@master
612+
with:
613+
context: .
614+
push: true
615+
tags: ${{ steps.metaMain.outputs.tags }}
616+
labels: ${{ steps.metaMain.outputs.labels }}
617+
- name: Build and push Docker image (from branch)
618+
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
619+
uses: docker/build-push-action@master
620+
with:
621+
context: .
622+
push: true
623+
tags: ${{ steps.meta.outputs.tags }}
624+
labels: ${{ steps.meta.outputs.labels }}
585625
env:
586626
NoCoverage: true
587627
SYSTEM_ACCESSTOKEN: ${{ secrets.AZUREDEVOPSPAT }}

GitHub/Jobs/BuildPSDevOps.psd1

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'RunPSSVG',
1010
'RunPipeScript',
1111
'RunEZOut',
12-
'RunHelpOut'
12+
'RunHelpOut',
13+
'BuildAndPublishContainer'
1314
)
1415
}

0 commit comments

Comments
 (0)