Skip to content

Commit

Permalink
make publish images parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
dsame committed Nov 11, 2023
1 parent 8d5f909 commit d916d16
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,9 @@
name: docker-image
path: az-appservice-go.tar.gz

choose-registry:
runs-on: ubuntu-latest
env:
dockerhub: true
azureregistry: true
outputs:
dockerhub: ${{ steps.choose.outputs.dockerhub }}
azureregistry: ${{ steps.choose.outputs.azureregistry }}
steps:
- name: Choose container registry
id: choose
run: |
echo "dockerhub==${dockerhub}" >> $GITHUB_OUTPUT
echo "azureregistry==${azureregistry}" >> $GITHUB_OUTPUT
publish-to-registry:
needs: [build, choose-registry]
publish-to-dockerhub:
if: ${{ true }}
needs: [build]
runs-on: ubuntu-latest

steps:
Expand All @@ -87,13 +73,29 @@
gunzip -c az-appservice-go.tar.gz| docker load
docker images
- name: Publish to Docker Hub
- name: Publish
if: ${{ needs.choose-registry.outputs.dockerhub }}
run: |
docker tag az-appservice-go ${{ secrets.DOCKER_USERNAME }}/az-appservice-go
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker push ${{ secrets.DOCKER_USERNAME }}/az-appservice-go
publish-to-azure-registry:
if: ${{ true }}
needs: [build]
runs-on: ubuntu-latest

steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: docker-image

- name: Untar docker image
run: |
gunzip -c az-appservice-go.tar.gz| docker load
docker images
- name: Publish to Azure Registry
if: ${{ needs.choose-registry.outputs.azureregistry }}
run: |
Expand All @@ -102,8 +104,7 @@
docker push akvtraining.azurecr.io/az-appservice-go
deplpoy-to-azure-from-dockerhub:
if: ${{ needs.choose-registry.outputs.dockerhub }}
needs: [publish-to-registry, choose-registry]
needs: [publish-to-dockerhub]
runs-on: ubuntu-latest

steps:
Expand All @@ -115,8 +116,7 @@
publish-profile: ${{ secrets.APP_GO_DOCKERHUB_PROFILE }}

deplpoy-to-azure-from-azure-regisrty:
if: ${{ needs.choose-registry.outputs.azureregistry }}
needs: [publish-to-registry, choose-registry]
needs: [publish-to-azure-registry]
runs-on: ubuntu-latest

steps:
Expand Down

0 comments on commit d916d16

Please sign in to comment.