From f18e9d6e8c78d64765de345fa777d4da54e67c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zawadzki?= Date: Thu, 22 Aug 2024 15:58:11 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20CD=20workflow=20for=202.0=20b?= =?UTF-8?q?ranch=20(#984)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd.yml | 129 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 000000000..5c4724000 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,129 @@ +name: Release + +on: + push: + tags: + - "v2.*.*" # Match tags that begin with "v2". + +jobs: + build-distribution: + name: Build distribution 📦 + timeout-minutes: 5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + 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@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish to PyPI 🚀 + timeout-minutes: 5 + needs: + - build-distribution + 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@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + + publish-docker-images: + name: Publish Docker images 🐳 + timeout-minutes: 15 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - 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: Construct the tag for Docker images + run: | + # Strip the "v" prefix for the image tag. + VERSION=${{ github.ref_name }} + echo "TAG=${VERSION#v}" >> $GITHUB_ENV + + - name: Build and publish viadot-lite image + uses: docker/build-push-action@v6 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64 + push: true + target: viadot-lite + tags: | + ghcr.io/${{ github.repository }}/viadot-lite:${{ env.TAG }} + ghcr.io/${{ github.repository }}/viadot-lite:latest + + - name: Build and publish viadot-aws image + uses: docker/build-push-action@v6 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64 + push: true + target: viadot-aws + tags: | + ghcr.io/${{ github.repository }}/viadot-aws:${{ env.TAG }} + ghcr.io/${{ github.repository }}/viadot-aws:latest + + - name: Build and publish viadot-azure image + uses: docker/build-push-action@v6 + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64 + push: true + target: viadot-azure + tags: | + ghcr.io/${{ github.repository }}/viadot-azure:${{ env.TAG }} + ghcr.io/${{ github.repository }}/viadot-azure:latest + build-args: INSTALL_DATABRICKS=false + + create_github_release: + name: Create a GitHub release 🔖 + timeout-minutes: 5 + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Create a release + uses: ncipollo/release-action@v1 + with: + generateReleaseNotes: true