From 15742084a317a002c6df4f73175a30f47be70213 Mon Sep 17 00:00:00 2001 From: Monique Rio Date: Fri, 20 Sep 2024 16:04:40 +0000 Subject: [PATCH 1/2] add default poetry version to the Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 87ff7f3..53b9482 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ FROM python:3.11-slim-bookworm as base # Allowing the argumenets to be read into the dockerfile. Ex: .env > compose.yml > Dockerfile -ARG POETRY_VERSION +ARG POETRY_VERSION=1.5.1 ARG UID=1000 ARG GID=1000 From 600902fb22f7ff1c5ff8dc9888eddbf8a1b43e15 Mon Sep 17 00:00:00 2001 From: Monique Rio Date: Fri, 20 Sep 2024 15:46:58 +0000 Subject: [PATCH 2/2] ci: add continuous deployment actions --- .../workflows/build-deploy-on-release.yaml | 26 +++++++++++++++++ .github/workflows/build-main.yml | 28 ++++++++++++++++++ .github/workflows/build-unstable.yaml | 17 +++++++++++ .../workflows/manual-deploy-production.yaml | 29 +++++++++++++++++++ .github/workflows/manual-deploy-workshop.yaml | 22 +++++++++++--- 5 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-deploy-on-release.yaml create mode 100644 .github/workflows/build-main.yml create mode 100644 .github/workflows/build-unstable.yaml create mode 100644 .github/workflows/manual-deploy-production.yaml diff --git a/.github/workflows/build-deploy-on-release.yaml b/.github/workflows/build-deploy-on-release.yaml new file mode 100644 index 0000000..5eaa635 --- /dev/null +++ b/.github/workflows/build-deploy-on-release.yaml @@ -0,0 +1,26 @@ +name: Deploy release + +on: + release: + types: [ released ] + +jobs: + build-production: + name: Build production ${{ github.event.release.tag_name }} + uses: mlibrary/platform-engineering-workflows/.github/workflows/build-production.yml@v1 + with: + image_name: ${{ vars.IMAGE_NAME }} + tag: ${{ github.event.release.tag_name }} + dockerfile: Dockerfile + secrets: inherit + + deploy-production-digifeeds: + needs: build-production + name: Deploy to production - digifeeds + uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1 + with: + image: ghcr.io/mlibrary/${{ vars.IMAGE_NAME }}:${{ github.event.release.tag_name }} + file: environments/digifeeds/production/app-image.txt + CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }} + CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }} + secrets: inherit diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml new file mode 100644 index 0000000..f579372 --- /dev/null +++ b/.github/workflows/build-main.yml @@ -0,0 +1,28 @@ +name: Docker Build Main and Deploy to Workshop + +on: + workflow_run: + workflows: [ 'Run Tests' ] + branches: [ main ] + types: [ completed ] + +jobs: + build-unstable: + name: Build unstable ${{ github.sha }} + uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1 + with: + image_name: ${{ vars.IMAGE_NAME }} + tag: ${{ github.sha }} + dockerfile: Dockerfile + secrets: inherit + + deploy-workshop-digifeeds: + needs: build-unstable + name: "Deploy to workshop - digifeeds" + uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1 + with: + image: ${{ needs.build-unstable.outputs.image }} + file: environments/digifeeds/workshop/app-image.txt + CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }} + CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }} + secrets: inherit diff --git a/.github/workflows/build-unstable.yaml b/.github/workflows/build-unstable.yaml new file mode 100644 index 0000000..00f1c08 --- /dev/null +++ b/.github/workflows/build-unstable.yaml @@ -0,0 +1,17 @@ +name: Build unstable image + +on: + workflow_dispatch: + inputs: + tag: + description: tag + required: true + +jobs: + build-unstable: + uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1 + with: + image_name: ${{ vars.IMAGE_NAME }} + tag: ${{ github.event.inputs.tag }} + dockerfile: Dockerfile + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/manual-deploy-production.yaml b/.github/workflows/manual-deploy-production.yaml new file mode 100644 index 0000000..326b2f1 --- /dev/null +++ b/.github/workflows/manual-deploy-production.yaml @@ -0,0 +1,29 @@ +name: Manual Deploy to Production + +on: + workflow_dispatch: + inputs: + tag: + description: tag + required: true + + +jobs: + build-production: + uses: mlibrary/platform-engineering-workflows/.github/workflows/build-production.yml@v1 + with: + image_name: ${{ vars.IMAGE_NAME }} + tag: ${{ github.event.inputs.tag }} + dockerfile: Dockerfile + secrets: inherit + + deploy-production-digifeeds: + needs: build-production + name: Deploy to production - digifeeds + uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1 + with: + image: ghcr.io/mlibrary/${{ vars.IMAGE_NAME }}:${{ github.event.inputs.tag }} + file: environments/digifeeds/production/app-image.txt + CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }} + CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }} + secrets: inherit diff --git a/.github/workflows/manual-deploy-workshop.yaml b/.github/workflows/manual-deploy-workshop.yaml index 87ab9c3..e8bec02 100644 --- a/.github/workflows/manual-deploy-workshop.yaml +++ b/.github/workflows/manual-deploy-workshop.yaml @@ -8,7 +8,21 @@ on: required: true jobs: - echo: - runs-on: ubuntu-latest - steps: - - run: echo "${{ github.event.inputs.tag }}" + build-unstable: + uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1 + with: + image_name: ${{ vars.IMAGE_NAME }} + tag: ${{ github.event.inputs.tag }} + dockerfile: Dockerfile + secrets: inherit + + deploy-workshop-digifeeds: + needs: build-unstable + name: Deploy to workshop - digifeeds + uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1 + with: + image: ${{ needs.build-unstable.outputs.image }} + file: environments/digifeeds/workshop/app-image.txt + CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }} + CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }} + secrets: inherit