Merge pull request #5815 from dependabot/mctofu/audit-fix-incomplete #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push docker images | |
env: | |
BASE_IMAGE: "ubuntu:20.04" | |
CORE_IMAGE: "dependabot/dependabot-core" | |
CORE_IMAGE_MIRROR: "ghcr.io/dependabot/dependabot-core" | |
UPDATER_IMAGE: "dependabot/dependabot-updater" | |
UPDATER_IMAGE_MIRROR: "ghcr.io/dependabot/dependabot-updater" | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
jobs: | |
push-core-image: | |
name: Push dependabot-core image to docker hub | |
runs-on: ubuntu-latest | |
if: github.repository == 'dependabot/dependabot-core' | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build dependabot-core image | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: | | |
docker build \ | |
-t "$CORE_IMAGE:latest" \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 \ | |
--cache-from "$BASE_IMAGE" \ | |
--cache-from "$CORE_IMAGE:latest" \ | |
. | |
- name: Log in to the Docker registry | |
run: | | |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
- name: Log in to GHCR | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push latest image | |
run: | | |
docker push "$CORE_IMAGE:latest" | |
docker tag "$CORE_IMAGE:latest" "$CORE_IMAGE_MIRROR:latest" | |
docker push "$CORE_IMAGE_MIRROR:latest" | |
- name: Push tagged image | |
if: contains(github.ref, 'refs/tags') | |
run: | | |
VERSION="$(grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" common/lib/dependabot/version.rb)" | |
docker tag "$CORE_IMAGE:latest" "$CORE_IMAGE:$VERSION" | |
docker push "$CORE_IMAGE:$VERSION" | |
docker tag "$CORE_IMAGE:latest" "$CORE_IMAGE_MIRROR:$VERSION" | |
docker push "$CORE_IMAGE_MIRROR:$VERSION" | |
push-updater-image: | |
name: Push tagged dependabot-updater image | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'refs/tags') | |
needs: push-core-image | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build dependabot-updater image | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: | | |
VERSION="$(grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" common/lib/dependabot/version.rb)" | |
docker build \ | |
-t "$UPDATER_IMAGE:latest" \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 \ | |
--cache-from "$BASE_IMAGE" \ | |
--cache-from "$UPDATER_IMAGE:latest" \ | |
--build-arg OMNIBUS_VERSION=$VERSION \ | |
-f Dockerfile.updater \ | |
. | |
- name: Log in to GHCR | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push tagged image | |
run: | | |
VERSION="$(grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" common/lib/dependabot/version.rb)" | |
docker tag "$UPDATER_IMAGE:latest" "$UPDATER_IMAGE:$VERSION" | |
docker push "$UPDATER_IMAGE:$VERSION" | |
docker tag "$UPDATER_IMAGE:latest" "$UPDATER_IMAGE_MIRROR:$VERSION" | |
docker push "$UPDATER_IMAGE_MIRROR:$VERSION" | |
push-development-image: | |
name: Push dependabot-core-development image to GHCR | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
needs: push-core-image | |
env: | |
DEV_IMAGE: ghcr.io/dependabot/dependabot-core-development | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build dependabot-core image | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: | | |
docker build \ | |
-t "$DEV_IMAGE:latest" \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 \ | |
--cache-from "$BASE_IMAGE" \ | |
--cache-from "$CORE_IMAGE:latest" \ | |
--cache-from "$DEV_IMAGE:latest" \ | |
-f Dockerfile.development . | |
- name: Log in to GHCR | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push latest image | |
run: | | |
docker push "$DEV_IMAGE:latest" | |
- name: Push tagged image | |
if: contains(github.ref, 'refs/tags') | |
run: | | |
VERSION="$(grep -Eo "[0-9]+\.[0-9]+\.[0-9]+" common/lib/dependabot/version.rb)" | |
docker tag "$DEV_IMAGE:latest" "$DEV_IMAGE:$VERSION" | |
docker push "$DEV_IMAGE:$VERSION" |