diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 2b691d9a..02fb5241 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -10,43 +10,44 @@ env: DEPLOYMENT: paysage-ui DEPLOYMENT_NAMESPACE: paysage DEPLOYMENT_URL: https://paysage.dataesr.ovh - MM_NOTIFICATION_CHANNEL: 'bots' + MM_NOTIFICATION_CHANNEL: bots jobs: publish-ghcr: name: Publish docker image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: ๐ Checkout + uses: actions/checkout@v4 - - name: Log into registry - run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + - name: ๐ท๏ธ Get tag + id: tag + run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT - - name: Build image - run: docker build -t ${{ github.repository }} --build-arg MODE=production . + - name: ๐ Login ghcr.io + run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - - name: Get Tag - id: version - run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: ๐ Build Docker image + run: | + IMAGE_ID=ghcr.io/${{ github.repository }} + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + docker build -t $IMAGE_ID:${{ steps.tag.outputs.tag }} -t $IMAGE_ID:latest --build-arg MODE=production . - - name: Push image + - name: ๐ฆ Push Docker image run: | IMAGE_ID=ghcr.io/${{ github.repository }} IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - docker tag ${{ github.repository }} $IMAGE_ID:latest - docker tag ${{ github.repository }} $IMAGE_ID:${{ steps.version.outputs.tag }} - docker push $IMAGE_ID:latest - docker push $IMAGE_ID:${{ steps.version.outputs.tag }} + docker push -a $IMAGE_ID deploy: name: Update production deployment runs-on: ubuntu-latest needs: publish-ghcr steps: - - name: Check Out Repo + - name: ๐ Checkout uses: actions/checkout@v4 - - name: Deploy to Cluster + - name: โ๏ธ Deploy to Cluster id: kubectl-deploy uses: dataesr/kubectl-deploy@v1.1 env: @@ -58,7 +59,7 @@ jobs: release: name: Release new version runs-on: ubuntu-latest - needs: publish-ghcr + needs: deploy steps: - name: Check Out Repo uses: actions/checkout@v4 @@ -84,9 +85,7 @@ jobs: body: "${{ steps.changelog.outputs.changes }}" notify: - needs: - - deploy - - release + needs: release if: always() runs-on: ubuntu-latest steps: diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 0ace822a..f7c851ef 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -10,31 +10,34 @@ env: DEPLOYMENT: paysage-ui DEPLOYMENT_NAMESPACE: paysage DEPLOYMENT_URL: https://paysage.staging.dataesr.ovh - MM_NOTIFICATION_CHANNEL: 'bots' + MM_NOTIFICATION_CHANNEL: bots jobs: publish-ghcr: name: Publish docker image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: ๐ Checkout + uses: actions/checkout@v4 - - name: Log into registry - run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} + - name: ๐ท๏ธ Get tag + id: tag + run: echo "tag=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - - name: Build image - run: docker build -t ${{ github.repository }} --build-arg MODE=staging . + - name: ๐ Login ghcr.io + run: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} - - name: Get Tag - id: version - run: echo "tag=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + - name: ๐ Build Docker image + run: | + IMAGE_ID=ghcr.io/${{ github.repository }} + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + docker build -t $IMAGE_ID:staging --build-arg MODE=staging . - - name: Push image + - name: ๐ฆ Push Docker image run: | IMAGE_ID=ghcr.io/${{ github.repository }} IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - docker tag ${{ github.repository }} $IMAGE_ID:${{ steps.version.outputs.tag }} - docker push $IMAGE_ID:${{ steps.version.outputs.tag }} + docker push $IMAGE_ID:staging deploy: name: Update staging deployment @@ -63,4 +66,4 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} mattermost_webhook_url: ${{ secrets.MATTERMOST_WEBHOOK_URL }} mattermost_channel: ${{ env.MM_NOTIFICATION_CHANNEL}} - deployment_url: ${{ env.DEPLOYMENT_URL }} \ No newline at end of file + deployment_url: ${{ env.DEPLOYMENT_URL }} diff --git a/src/pages/structures/[id]/chiffres-cles/offre-de-formation.js b/src/pages/structures/[id]/chiffres-cles/offre-de-formation.js index 9ce64702..0090efca 100644 --- a/src/pages/structures/[id]/chiffres-cles/offre-de-formation.js +++ b/src/pages/structures/[id]/chiffres-cles/offre-de-formation.js @@ -1,27 +1,24 @@ import { Col, Icon, Row, Title } from '@dataesr/react-dsfr'; - import { useEffect, useState } from 'react'; -import { - Bloc, - BlocContent, -} from '../../../../components/bloc'; +import { Bloc, BlocContent } from '../../../../components/bloc'; import WeblinkCard from '../../../../components/card/weblink-card'; import useUrl from '../../../../hooks/useUrl'; export default function StructureOffreDeFormationPage() { const { id } = useUrl('keynumbers'); - const [formationCount, setFormationCount] = useState({ totalCount: 0 }); useEffect(() => { - // eslint-disable-next-line max-len - fetch(`https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-principaux-diplomes-et-formations-prepares-etablissements-publics/records?limit=20&refine=etablissement_id_paysage:"${id}"`) - .then((response) => response.json()) - .then((data) => { - const totalCount = data && data.total_count ? data.total_count : 0; - setFormationCount({ totalCount }); - }); - }); + if (id) { + // eslint-disable-next-line max-len + fetch(`https://data.enseignementsup-recherche.gouv.fr/api/explore/v2.1/catalog/datasets/fr-esr-principaux-diplomes-et-formations-prepares-etablissements-publics/records?limit=20&refine=etablissement_id_paysage:${id}`) + .then((response) => response.json()) + .then((data) => { + const totalCount = data && data.total_count ? data.total_count : 0; + setFormationCount({ totalCount }); + }); + } + }, [id]); if (formationCount.totalCount === 0) { return (