From bae1f8d77f489455631bfde3dc700ae66b39580a Mon Sep 17 00:00:00 2001 From: Gitesh Koli Date: Tue, 16 Nov 2021 21:39:10 -0500 Subject: [PATCH] Correct container registry urls (#15) * Updated permissions for Github actions to work * switch to using github tokens --- .github/workflows/main.yaml | 13 ++++++++++--- .github/workflows/release.yaml | 12 ++++++++---- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index aae9406..ad76681 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -22,14 +22,21 @@ on: env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io - IMAGE_NAME: docker-apigee-drupal-kickstart + IMAGE_NAME: ${{github.repository_owner}}/docker-apigee-drupal-kickstart jobs: push_to_registry: name: Build Docker image runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: - name: Check out the repo uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} @@ -38,12 +45,12 @@ jobs: with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ github.token }} - name: Extract Docker metadata id: meta uses: docker/metadata-action@v3 with: - images: ${{github.repository_owner}}/${{ env.IMAGE_NAME }} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Push to GitHub Packages uses: docker/build-push-action@v2 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f3c2d42..128007f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,11 +19,15 @@ on: env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io - IMAGE_NAME: docker-apigee-drupal-kickstart + IMAGE_NAME: ${{github.repository_owner}}/docker-apigee-drupal-kickstart jobs: push_to_registry: name: Push Docker image to GitHub Packages runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: - name: Check out the repo uses: actions/checkout@v2 @@ -32,12 +36,12 @@ jobs: with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ github.token }} - name: Extract Docker metadata id: meta uses: docker/metadata-action@v3 with: - images: ${{github.repository_owner}}/${{ env.IMAGE_NAME }} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=tag type=raw,stable @@ -46,4 +50,4 @@ jobs: with: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }}