Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Apr 20, 2024
1 parent 479987f commit c8161cd
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 7 deletions.
44 changes: 43 additions & 1 deletion .github/workflows/BuildAndPublishPosh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,49 @@ jobs:
id: EZOut
- name: UseHelpOut
uses: StartAutomating/HelpOut@master
- name: PSA
uses: StartAutomating/PSA@main
id: PSA
- name: GitLogger
uses: GitLogging/GitLoggerAction@main
id: GitLogger

- name: Log in to ghcr.io
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker Metadata (for branch)
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
id: meta
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Extract Docker Metadata (for main)
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
id: metaMain
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=true
- 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: ${{ steps.metaMain.outputs.tags }}
labels: ${{ steps.metaMain.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 }}
env:
AT_PROTOCOL_HANDLE: mrpowershell.bsky.social
AT_PROTOCOL_APP_PASSWORD: ${{ secrets.AT_PROTOCOL_APP_PASSWORD }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
59 changes: 55 additions & 4 deletions Build/GitHub/Jobs/BuildPosh.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,64 @@
}
'RunHelpOut',
@{
name = 'GitLogger'
uses = 'GitLogging/GitLoggerAction@main'
id = 'GitLogger'
},@{
name = 'PSA'
uses = 'StartAutomating/PSA@main'
id = 'PSA'
},
@{
name = 'GitLogger'
uses = 'GitLogging/GitLoggerAction@main'
id = 'GitLogger'
},
@{
'name'='Log in to ghcr.io'
'uses'='docker/login-action@master'
'with'=@{
'registry'='${{ env.REGISTRY }}'
'username'='${{ github.actor }}'
'password'='${{ secrets.GITHUB_TOKEN }}'
}
},
@{
name = 'Extract Docker Metadata (for branch)'
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
id = 'meta'
uses = 'docker/metadata-action@master'
with = @{
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
}
},
@{
name = 'Extract Docker Metadata (for main)'
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
id = 'metaMain'
uses = 'docker/metadata-action@master'
with = @{
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
'flavor'='latest=true'
}
},
@{
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'='${{ steps.metaMain.outputs.tags }}'
'labels'='${{ steps.metaMain.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/Posh.GitHubWorkflow.PSDevOps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ New-GitHubWorkflow -Name "Build and Publish Posh" -On Demand, Push -Job TagRelea
TestPowerShellOnLinux,
BuildPosh -OutputPath (
Join-Path $pwd .\.github\workflows\BuildAndPublishPosh.yml
) -Env @{
) -Env ([Ordered]@{
"AT_PROTOCOL_HANDLE" = "mrpowershell.bsky.social"
"AT_PROTOCOL_APP_PASSWORD" = '${{ secrets.AT_PROTOCOL_APP_PASSWORD }}'
}
"REGISTRY" = "ghcr.io"
"IMAGE_NAME" = '${{ github.repository }}'
})

Pop-Location

0 comments on commit c8161cd

Please sign in to comment.