Skip to content

Commit 19246cd

Browse files
author
James Brundage
committed
feat: GQL Container Build ( Fixes #4, Fixes #5, Fixes #10, Fixes #11, Fixes #12 )
1 parent 7da03cc commit 19246cd

File tree

5 files changed

+153
-0
lines changed

5 files changed

+153
-0
lines changed

.github/workflows/BuildGQL.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,4 +504,44 @@ jobs:
504504
uses: StartAutomating/EZOut@master
505505
- name: UseHelpOut
506506
uses: StartAutomating/HelpOut@master
507+
- name: Log in to ghcr.io
508+
uses: docker/login-action@master
509+
with:
510+
registry: ${{ env.REGISTRY }}
511+
username: ${{ github.actor }}
512+
password: ${{ secrets.GITHUB_TOKEN }}
513+
env:
514+
REGISTRY: ghcr.io
515+
- name: Extract Docker Metadata (for branch)
516+
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
517+
id: meta
518+
uses: docker/metadata-action@master
519+
with:
520+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
521+
env:
522+
REGISTRY: ghcr.io
523+
IMAGE_NAME: ${{ github.repository }}
524+
- name: Extract Docker Metadata (for main)
525+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
526+
id: metaMain
527+
uses: docker/metadata-action@master
528+
with:
529+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
530+
flavor: latest=true
531+
- name: Build and push Docker image (from main)
532+
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
533+
uses: docker/build-push-action@master
534+
with:
535+
context: .
536+
push: true
537+
tags: ${{ steps.metaMain.outputs.tags }}
538+
labels: ${{ steps.metaMain.outputs.labels }}
539+
- name: Build and push Docker image (from branch)
540+
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
541+
uses: docker/build-push-action@master
542+
with:
543+
context: .
544+
push: true
545+
tags: ${{ steps.meta.outputs.tags }}
546+
labels: ${{ steps.meta.outputs.labels }}
507547

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#requires -Module PSDevOps
2+
Import-BuildStep -SourcePath (
3+
Join-Path $PSScriptRoot 'GitHub'
4+
) -BuildSystem GitHubWorkflow
5+
6+
Push-Location ($PSScriptRoot | Split-Path)
7+
New-GitHubWorkflow -Name "Build GQL" -On Push,
8+
PullRequest,
9+
Demand -Job TestPowerShellOnLinux,
10+
TagReleaseAndPublish, BuildGQL -OutputPath .\.github\workflows\BuildGQL.yml
11+
12+
Pop-Location

Build/GitHub/Jobs/BuildGQL.psd1

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 = 'GitLogger'
11+
uses = 'GitLogging/GitLoggerAction@main'
12+
id = 'GitLogger'
13+
},
14+
@{
15+
name = 'Use PSSVG Action'
16+
uses = 'StartAutomating/PSSVG@main'
17+
id = 'PSSVG'
18+
},
19+
@{
20+
name = 'Use PipeScript Action'
21+
uses = 'StartAutomating/PipeScript@main'
22+
id = 'PipeScript'
23+
},
24+
'RunEZOut',
25+
'RunHelpOut'
26+
<#@{
27+
name = 'Run HtmxPS (on branch)'
28+
if = '${{github.ref_name != ''main''}}'
29+
uses = './'
30+
id = 'ActionOnBranch'
31+
},#>
32+
'BuildAndPublishContainer'
33+
)
34+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@{
2+
'name'='Log in to ghcr.io'
3+
'uses'='docker/login-action@master'
4+
'with'=@{
5+
'registry'='${{ env.REGISTRY }}'
6+
'username'='${{ github.actor }}'
7+
'password'='${{ secrets.GITHUB_TOKEN }}'
8+
}
9+
env = @{
10+
'REGISTRY'='ghcr.io'
11+
}
12+
}
13+
@{
14+
name = 'Extract Docker Metadata (for branch)'
15+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
16+
id = 'meta'
17+
uses = 'docker/metadata-action@master'
18+
with = @{
19+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
20+
}
21+
env = @{
22+
REGISTRY = 'ghcr.io'
23+
IMAGE_NAME = '${{ github.repository }}'
24+
}
25+
}
26+
@{
27+
name = 'Extract Docker Metadata (for main)'
28+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
29+
id = 'metaMain'
30+
uses = 'docker/metadata-action@master'
31+
with = @{
32+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
33+
'flavor'='latest=true'
34+
}
35+
}
36+
@{
37+
name = 'Build and push Docker image (from main)'
38+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
39+
uses = 'docker/build-push-action@master'
40+
with = @{
41+
'context'='.'
42+
'push'='true'
43+
'tags'='${{ steps.metaMain.outputs.tags }}'
44+
'labels'='${{ steps.metaMain.outputs.labels }}'
45+
}
46+
}
47+
@{
48+
name = 'Build and push Docker image (from branch)'
49+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
50+
uses = 'docker/build-push-action@master'
51+
with = @{
52+
'context'='.'
53+
'push'='true'
54+
'tags'='${{ steps.meta.outputs.tags }}'
55+
'labels'='${{ steps.meta.outputs.labels }}'
56+
}
57+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@{
2+
name = 'PublishTestResults'
3+
uses = 'actions/upload-artifact@v3'
4+
with = @{
5+
name = 'PesterResults'
6+
path = '**.TestResults.xml'
7+
}
8+
if = '${{always()}}'
9+
}
10+

0 commit comments

Comments
 (0)