From b984959b5e638a4fb4e77db578ba859b0549fefc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zawadzki?= Date: Wed, 14 Aug 2024 14:23:48 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Update=202.0=20branch=20wo?= =?UTF-8?q?rkflows=20(#973)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/2.0/docker-publish.yml | 67 +++++++++++++++++++++++ .github/workflows/2.0/publish_to_pypi.yml | 48 ++++++++++++++++ .github/workflows/build-2.0.yml | 37 ------------- 3 files changed, 115 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/2.0/docker-publish.yml create mode 100644 .github/workflows/2.0/publish_to_pypi.yml delete mode 100644 .github/workflows/build-2.0.yml diff --git a/.github/workflows/2.0/docker-publish.yml b/.github/workflows/2.0/docker-publish.yml new file mode 100644 index 000000000..f8270920b --- /dev/null +++ b/.github/workflows/2.0/docker-publish.yml @@ -0,0 +1,67 @@ +# Publish viadot images with a specified tag. +name: "Publish Docker images" +run-name: "Publish viadot-*:${{ github.event.inputs.tag }} images (@${{ github.actor }})" + +on: + workflow_dispatch: + inputs: + tag: + description: "The tag to use for the image." + required: true + default: "dev" + install_databricks: + description: "Whether to install Databricks source dependencies." + required: false + default: "false" +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log into GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and publish viadot-lite image + uses: docker/build-push-action@v3 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64 + push: true + target: viadot-lite + tags: ghcr.io/${{ github.repository }}/viadot-lite:${{ github.event.inputs.tag }} + + - name: Build and publish viadot-aws image + uses: docker/build-push-action@v3 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64 + push: true + target: viadot-aws + tags: ghcr.io/${{ github.repository }}/viadot-aws:${{ github.event.inputs.tag }} + + - name: Build and publish viadot-azure image + uses: docker/build-push-action@v3 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64 + push: true + target: viadot-azure + tags: ghcr.io/${{ github.repository }}/viadot-azure:${{ github.event.inputs.tag }} + build-args: INSTALL_DATABRICKS=${{ github.event.inputs.install_databricks }} diff --git a/.github/workflows/2.0/publish_to_pypi.yml b/.github/workflows/2.0/publish_to_pypi.yml new file mode 100644 index 000000000..96b335f8b --- /dev/null +++ b/.github/workflows/2.0/publish_to_pypi.yml @@ -0,0 +1,48 @@ +name: "Publish to PyPI" +# Publish a viadot branch to PyPI. +# The branch is either picked from the dropdown (if the workflow is ran manually), +# or the branch where the workflow was triggered. +run-name: "Publish viadot to PyPI (@${{ github.actor }})" + +on: + workflow_dispatch: + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install pypa/build + run: python3 -m pip install build --user + + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish: + name: Publish to PyPI 🚀 + needs: + - build + runs-on: ubuntu-latest + environment: + name: release + url: https://pypi.org/p/viadot2 + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/build-2.0.yml b/.github/workflows/build-2.0.yml deleted file mode 100644 index 40bccc503..000000000 --- a/.github/workflows/build-2.0.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: build-2.0 - -on: - push: - branches: - - "2.0" - -jobs: - publish-docker-image: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Log into GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build - uses: docker/build-push-action@v3 - with: - context: . - file: docker/Dockerfile - platforms: linux/amd64 - push: true - tags: ghcr.io/${{ github.repository }}/viadot:2.0-latest \ No newline at end of file