From 90f37ffb05c888d3d1a7d30bd54887df9476b312 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Thu, 28 Mar 2024 14:26:46 -0500 Subject: [PATCH] add docker release --- .github/workflows/release-docker.yml | 100 --------------------------- .github/workflows/release.yml | 10 +++ 2 files changed, 10 insertions(+), 100 deletions(-) delete mode 100644 .github/workflows/release-docker.yml diff --git a/.github/workflows/release-docker.yml b/.github/workflows/release-docker.yml deleted file mode 100644 index 63248784fc8..00000000000 --- a/.github/workflows/release-docker.yml +++ /dev/null @@ -1,100 +0,0 @@ -# **what?** -# This workflow will generate a series of docker images for dbt and push them to the github container registry -# -# **why?** -# Docker images for dbt are used in a number of important places throughout the dbt ecosystem. -# This is how we keep those images up-to-date. -# -# **when?** -# This is triggered manually -name: Docker release - -permissions: - packages: write - -on: - workflow_dispatch: - inputs: - package: - description: The package to release - type: choice - options: - - dbt-core - - dbt-bigquery - - dbt-postgres - - dbt-redshift - - dbt-snowflake - - dbt-spark - required: true - version_number: - description: The version number to release as a SemVer (e.g. 1.0.0b1, without `latest` or `v`) - required: true - dry_run: - description: Dry Run (don't publish) - type: boolean - default: false - -jobs: - version_metadata: - name: Get version metadata - runs-on: ubuntu-latest - outputs: - fully_qualified_tags: ${{ steps.tags.outputs.fully_qualified_tags }} - steps: - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Get the tags to publish - id: tags - uses: ./.github/actions/latest-wrangler - with: - package_name: ${{ inputs.package }} - new_version: ${{ inputs.version_number }} - github_token: ${{ secrets.GITHUB_TOKEN }} - - setup_image_builder: - name: Set up Docker image builder - runs-on: ubuntu-latest - needs: [version_metadata] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - build_and_push: - name: Build images and push to GHCR - runs-on: ubuntu-latest - needs: [setup_image_builder, version_metadata] - steps: - - name: Get docker build arg - id: build_arg - run: | - BUILD_ARG_NAME=$(echo ${{ inputs.package }} | sed 's/\-/_/g') - BUILD_ARG_VALUE=$(echo ${{ inputs.package }} | sed 's/postgres/core/g') - echo "name=$BUILD_ARG_NAME" >> $GITHUB_OUTPUT - echo "value=$BUILD_ARG_VALUE" >> $GITHUB_OUTPUT - - - name: Log in to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Log publishing configuration - shell: bash - run: | - echo Package: ${{ inputs.package }} - echo Version: ${{ inputs.version_number }} - echo Tags: ${{ needs.version_metadata.outputs.fully_qualified_tags }} - echo Build Arg Name: ${{ steps.build_arg.outputs.name }} - echo Build Arg Value: ${{ steps.build_arg.outputs.value }} - - - name: Build and push `${{ inputs.package }}` - if: ${{ !inputs.dry_run }} - uses: docker/build-push-action@v5 - with: - file: docker/Dockerfile - push: True - target: ${{ inputs.package }} - build-args: ${{ steps.build_arg.outputs.name }}_ref=${{ steps.build_arg.outputs.value }}@v${{ inputs.version_number }} - tags: ${{ needs.version_metadata.outputs.fully_qualified_tags }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b9cd73baa0..edb3bf5f58a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -174,6 +174,16 @@ jobs: PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} + docker-release: + name: Docker Release + needs: [pypi-release] + + uses: dbt-labs/dbt-release/.github/workflows/docker-release.yml@main + with: + package: ${{ github.event.repository.name }} + version_number: ${{ inputs.version_number }} + test_run: ${{ inputs.test_run }} + slack-notification: name: Slack Notification if: ${{ failure() && (!inputs.test_run || inputs.nightly_release) }}