From 8833dbaf5ddb010e2abbe0ebeb83353de09eaa1b Mon Sep 17 00:00:00 2001 From: salem84 Date: Mon, 5 Oct 2020 22:32:06 +0000 Subject: [PATCH] update workflows to use GH Container Registry --- .github/workflows/push-latest.yml | 11 +++++++++-- .github/workflows/release.yml | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push-latest.yml b/.github/workflows/push-latest.yml index 03539eb..8ef61d1 100644 --- a/.github/workflows/push-latest.yml +++ b/.github/workflows/push-latest.yml @@ -33,14 +33,21 @@ jobs: uses: actions/checkout@v2 - name: Build image - run: docker image build . --file Dockerfile --tag $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG + run: docker image build . --file Dockerfile --tag $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG --tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$IMAGE_TAG - name: Login to Docker Hub registry run: echo '${{ secrets.DOCKERHUB_PASS }}' | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - - name: Push image to registry + - name: Push image to Docker Hub registry run: docker push $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG + # CR_PAT contains a PAT with `write:packages` and `read:packages` scopes + - name: Log into GitHub Container Registry + run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Push image to GitHub Container registry + run: docker push ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$IMAGE_TAG + - name: Save image run: docker image save -o $IMAGE_NAME-$IMAGE_TAG.tar $ORGANIZATION/$IMAGE_NAME:$IMAGE_TAG diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d644ee..7271e67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,14 +48,21 @@ jobs: run: echo "::set-env name=IMAGE_RELEASE_TAG::release-${RELEASE_TAG}_terraform-${{ matrix.tf_version }}_azcli-${{ matrix.azcli_version }}" - name: Build image - run: docker image build . --file Dockerfile --build-arg TERRAFORM_VERSION=${{ matrix.tf_version }} --build-arg AZURE_CLI_VERSION=${{ matrix.azcli_version }} --tag ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG} + run: docker image build . --file Dockerfile --build-arg TERRAFORM_VERSION=${{ matrix.tf_version }} --build-arg AZURE_CLI_VERSION=${{ matrix.azcli_version }} --tag ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG} --tag ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG} - name: Login to Docker Hub registry run: echo '${{ secrets.DOCKERHUB_PASS }}' | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin - - name: Push image to registry + - name: Push image to Docker Hub registry run: docker push ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG} + # CR_PAT secret contains a PAT with `write:packages` and `read:packages` scopes + - name: Log into GitHub Container Registry + run: echo "${{ secrets.CR_PAT }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin + + - name: Push image to GitHub Container registry + run: docker push ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG} + - name: Save image run: docker image save -o ${IMAGE_NAME}-${IMAGE_RELEASE_TAG}.tar ${ORGANIZATION}/${IMAGE_NAME}:${IMAGE_RELEASE_TAG}