This commit introduces a boilerplate inspired by https://github.com/numerique-gouv/impress. The code has been cleaned to remove unnecessary Impress logic and dependencies. Changes made: - Removed Minio, WebRTC, and create bucket from the stack. - Removed the Next.js frontend (it will be replaced by Vite). - Cleaned up impress-specific backend logics. The whole stack remains functional: - All tests pass. - Linter checks pass. - Agent Connexion sources are already set-up. Why clear out the code? To adhere to the KISS principle, we aim to maintain a minimalist codebase. Cloning Impress allowed us to quickly inherit its code quality tools and deployment configurations for staging, pre-production, and production environments. What’s broken? - The tsclient is not functional anymore. - Some make commands need to be fixed. - Helm sources are outdated. - Naming across the project sources are inconsistent (impress, visio, etc.) - CI is not configured properly. This list might be incomplete. Let's grind it.
53 lines
1.7 KiB
YAML
53 lines
1.7 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'preprod'
|
|
- 'production'
|
|
|
|
|
|
jobs:
|
|
notify-argocd:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
uses: actions/create-github-app-token@v1
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ secrets.APP_ID }}
|
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
|
owner: ${{ github.repository_owner }}
|
|
repositories: "impress,secrets"
|
|
-
|
|
name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: recursive
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
-
|
|
name: Load sops secrets
|
|
uses: rouja/actions-sops@main
|
|
with:
|
|
secret-file: secrets/numerique-gouv/impress/secrets.enc.env
|
|
age-key: ${{ secrets.SOPS_PRIVATE }}
|
|
-
|
|
name: Call argocd github webhook
|
|
run: |
|
|
data='{"ref": "'$GITHUB_REF'","repository": {"html_url":"'$GITHUB_SERVER_URL'/'$GITHUB_REPOSITORY'"}}'
|
|
sig=$(echo -n ${data} | openssl dgst -sha1 -hmac ''${ARGOCD_WEBHOOK_SECRET}'' | awk '{print "X-Hub-Signature: sha1="$2}')
|
|
curl -X POST -H 'X-GitHub-Event:push' -H "Content-Type: application/json" -H "${sig}" --data "${data}" $ARGOCD_WEBHOOK_URL
|
|
sig=$(echo -n ${data} | openssl dgst -sha1 -hmac ''${ARGOCD_PRODUCTION_WEBHOOK_SECRET}'' | awk '{print "X-Hub-Signature: sha1="$2}')
|
|
curl -X POST -H 'X-GitHub-Event:push' -H "Content-Type: application/json" -H "${sig}" --data "${data}" $ARGOCD_PRODUCTION_WEBHOOK_URL
|
|
|
|
start-test-on-preprod:
|
|
needs:
|
|
- notify-argocd
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.event.ref, 'refs/tags/preprod')
|
|
steps:
|
|
-
|
|
name: Debug
|
|
run: |
|
|
echo "Start test when preprod is ready"
|