Skip to content

Déploiement du backend sur preprod #156

Déploiement du backend sur preprod

Déploiement du backend sur preprod #156

Workflow file for this run

name: Déploiement à la demande du backend
run-name: Déploiement du backend sur ${{ github.event.inputs.target }}
on:
workflow_dispatch:
inputs:
target:
type: choice
description: Quel environnement ?
options:
- preprod
- prod
is-test-backend:
type: boolean
description: Backend de test
jobs:
build-backend:
name: Build le backend
environment: ${{ github.event.inputs.target }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GH_TOKEN }}
version: ^0.8.0
- name: Login into registry
run: docker login ghcr.io/territoiresentransitions --username "${{ secrets.GH_USER }}" --password "${{ secrets.GH_TOKEN }}"
- name: Build and push backend image
run: >
earthly
--use-inline-cache --save-inline-cache --push
--platform=linux/amd64
+backend-docker
--ENV_NAME=${{ github.event.inputs.target }}
deploy-backend:
name: Déploie le backend
if: ${{ github.event.inputs.is-test-backend != 'true' }}
needs: build-backend
environment: ${{ github.event.inputs.target }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GH_TOKEN }}
version: ^0.8.0
- name: Login into registry
run: docker login ghcr.io/territoiresentransitions --username "${{ secrets.GH_USER }}" --password "${{ secrets.GH_TOKEN }}"
- name: Deploy app on Koyeb
run: >
earthly
--use-inline-cache --save-inline-cache
+backend-deploy
--ENV_NAME=${{ github.event.inputs.target }}
--KOYEB_API_KEY=${{ secrets.KOYEB_API_KEY }}
--TRAJECTOIRE_SNBC_SHEET_ID=${{ vars.TRAJECTOIRE_SNBC_SHEET_ID }}
--TRAJECTOIRE_SNBC_XLSX_ID=${{ vars.TRAJECTOIRE_SNBC_XLSX_ID }}
--TRAJECTOIRE_SNBC_RESULT_FOLDER_ID=${{ vars.TRAJECTOIRE_SNBC_RESULT_FOLDER_ID }}
--REFERENTIEL_TE_SHEET_ID=${{ vars.REFERENTIEL_TE_SHEET_ID }}
deploy-test-backend:
name: Déploie le backend de test
if: ${{ github.event.inputs.is-test-backend == 'true' }}
needs: build-backend
environment: ${{ github.event.inputs.target }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: earthly/actions-setup@v1
with:
github-token: ${{ secrets.GH_TOKEN }}
version: ^0.8.0
- name: Login into registry
run: docker login ghcr.io/territoiresentransitions --username "${{ secrets.GH_USER }}" --password "${{ secrets.GH_TOKEN }}"
- name: Deploy app on Koyeb
run: >
earthly
--use-inline-cache --save-inline-cache
+backend-deploy
--ENV_NAME=${{ github.event.inputs.target }}
--KOYEB_API_KEY=${{ secrets.KOYEB_API_KEY }}
--TRAJECTOIRE_SNBC_SHEET_ID=${{ vars.TRAJECTOIRE_SNBC_SHEET_ID }}
--TRAJECTOIRE_SNBC_XLSX_ID=${{ vars.TRAJECTOIRE_SNBC_XLSX_ID }}
--TRAJECTOIRE_SNBC_RESULT_FOLDER_ID=${{ vars.TRAJECTOIRE_SNBC_RESULT_FOLDER_ID }}
--REFERENTIEL_TE_SHEET_ID=${{ vars.REFERENTIEL_TE_SHEET_ID }}
--SERVICE_NAME=test-${{ github.event.inputs.target }}-backend