Skip to content

Commit

Permalink
fix: ShowDemo Docker Publishing ( Fixes #105 )
Browse files Browse the repository at this point in the history
Checking out a latest branch a little earlier.
  • Loading branch information
James Brundage committed Apr 14, 2024
1 parent 3e3816a commit ee64c4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/BuildShowDemo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -613,23 +613,15 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Switch to latest branch (if on main)
if: ${{github.ref_name == 'main' || github.ref_name == 'master'}}
run: git checkout -b latest
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- if: ${{github.ref_name == 'main' || github.ref_name == 'master'}}
run: git checkout -b latest
- 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: .
Expand Down
21 changes: 5 additions & 16 deletions Build/GitHub/Jobs/BuildShowDemo.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
'password'='${{ secrets.GITHUB_TOKEN }}'
}
},
@{
name = 'Switch to latest branch (if on main)'
if = '${{github.ref_name == ''main'' || github.ref_name == ''master''}}'
run = 'git checkout -b latest'
},
@{
'name'='Extract metadata (tags, labels) for Docker'
'id'='meta'
Expand All @@ -67,24 +72,8 @@
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
}
},
@{
if = '${{github.ref_name == ''main'' || github.ref_name == ''master''}}'
run = 'git checkout -b latest'
},
@{
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'='.'
Expand Down

0 comments on commit ee64c4d

Please sign in to comment.