From 1c2c642e9cbfd7c4b31978db68df43f067afb6ab Mon Sep 17 00:00:00 2001 From: Christopher Cave-Ayland Date: Wed, 3 Apr 2024 15:25:07 +0100 Subject: [PATCH] Setup CI deployment --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ deploy.py | 13 +++++++++++++ requirements.txt | 1 + 3 files changed, 49 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 deploy.py create mode 100644 requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..23e5237 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI +on: push +jobs: + build-and-publish: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get image metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository }} + - name: Install requirements + run: pip install -r requirements.txt + - name: Login to prefect cloud + run: prefect cloud login --key ${{ secrets.PREFECT_API_KEY }} --workspace "chrisca/default" + - name: deploy + run: python deploy.py ${{steps.meta.outputs.tags }} + + # - name: Build and push Docker image + # uses: docker/build-push-action@v4 + # with: + # context: . + # push: true + # tags: ${{steps.meta.outputs.tags }} diff --git a/deploy.py b/deploy.py new file mode 100644 index 0000000..4d1a375 --- /dev/null +++ b/deploy.py @@ -0,0 +1,13 @@ +import sys +from hello_world import my_flow + +image = sys.argv[1] + +my_flow.deploy( + name="my-docker-deployment", + work_pool_name="Test", + tags=["onboarding"], + parameters={"value": 1}, + interval=60, + image=image, +) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..49c6405 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +prefect==2.16.8