Skip to content

Commit

Permalink
feat: ShowDemo Docker Publishing ( Fixes #105 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Apr 14, 2024
1 parent 7bb3c39 commit 2693fcc
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 3 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/BuildShowDemo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,38 @@ jobs:
- name: PSA
uses: StartAutomating/PSA@main
id: PSA
- name: Log in to the Container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- 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: latest
labels: ${{ steps.meta.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:
pull_request:
env:
AT_PROTOCOL_APP_PASSWORD: ${{ secrets.AT_PROTOCOL_APP_PASSWORD }}
AT_PROTOCOL_HANDLE: mrpowershell.bsky.social
AT_PROTOCOL_APP_PASSWORD: ${{ secrets.AT_PROTOCOL_APP_PASSWORD }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
39 changes: 39 additions & 0 deletions Build/GitHub/Jobs/BuildShowDemo.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,44 @@
uses = 'StartAutomating/PSA@main'
id = 'PSA'
}
@{
'name'='Log in to the Container registry'
'uses'='docker/login-action@master'
'with'=@{
'registry'='${{ env.REGISTRY }}'
'username'='${{ github.actor }}'
'password'='${{ secrets.GITHUB_TOKEN }}'
}
},
@{
'name'='Extract metadata (tags, labels) for Docker'
'id'='meta'
'uses'='docker/metadata-action@master'
'with'=@{
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
}
},
@{
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'='latest'
'labels'='${{ steps.meta.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 }}'
}
}
)
}
6 changes: 4 additions & 2 deletions Build/ShowDemo.GitHubWorkflow.PSDevOps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Push-Location ($PSScriptRoot | Split-Path)

New-GitHubWorkflow -Job PowerShellStaticAnalysis, TestPowerShellOnLinux, TagReleaseAndPublish, BuildShowDemo -OutputPath @'
.\.github\workflows\BuildShowDemo.yml
'@ -Name "Build, Test, and Release ShowDemo" -On Push, PullRequest -Env @{
'@ -Name "Build, Test, and Release ShowDemo" -On Push, PullRequest -Env ([Ordered]@{
"AT_PROTOCOL_HANDLE" = "mrpowershell.bsky.social"
"AT_PROTOCOL_APP_PASSWORD" = '${{ secrets.AT_PROTOCOL_APP_PASSWORD }}'
}
"REGISTRY" = "ghcr.io"
"IMAGE_NAME" = '${{ github.repository }}'
})

Import-BuildStep -ModuleName GitPub

Expand Down

0 comments on commit 2693fcc

Please sign in to comment.