Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DWI-24 Set up continuous deployment #2

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/build-deploy-on-release.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 17 additions & 0 deletions .github/workflows/build-unstable.yaml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions .github/workflows/manual-deploy-production.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 18 additions & 4 deletions .github/workflows/manual-deploy-workshop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down