diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 76d2cd7b..c9490581 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -13,6 +13,17 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Log in with Azure + uses: azure/login@v1 + with: + creds: '${{ secrets.AZURE_CREDENTIALS }}' + + - name: Authenticate + env: + CLIENT_ID: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientId }} + CLIENT_SECRET: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientSecret }} + run: ./scripts/ciauthenticate + - name: Run cibuild run: ./scripts/cibuild @@ -28,14 +39,6 @@ jobs: ;; esac - - name: Log into the ACR - env: - CLIENT_ID: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientId }} - CLIENT_SECRET: ${{ fromJSON(secrets.AZURE_CREDENTIALS).clientSecret }} - run: - docker login pcccr.azurecr.io --username ${CLIENT_ID} --password ${CLIENT_SECRET} - az acr login --name pcccr --username ${CLIENT_ID} --password ${CLIENT_SECRET} - - name: Publish images run: ./scripts/cipublish --acr pcccr --tag ${{steps.get_image_tag.outputs.tag}} diff --git a/scripts/ciauthenticate b/scripts/ciauthenticate new file mode 100755 index 00000000..bff04b3b --- /dev/null +++ b/scripts/ciauthenticate @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +if [[ "${CI}" ]]; then + set -x +fi + +function usage() { + echo -n \ + "Usage: $(basename "$0") +CI authentication for this project. +" +} + +# curl -sL https://aka.ms/InstallAzureCLIDeb | bash +# az login --service-principal --username ${CLIENT_ID} --tenant "microsoft.onmicrosoft.com" --password ${CLIENT_SECRET} +az acr login --name pcccr +docker login pcccr.azurecr.io --username ${CLIENT_ID} --password ${CLIENT_SECRET} \ No newline at end of file