Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Sep 6, 2024
2 parents ea7615c + 2c603c6 commit 0fec82a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 57 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
env:
Expand All @@ -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
Expand All @@ -84,9 +85,7 @@ jobs:
body: "${{ steps.changelog.outputs.changes }}"

notify:
needs:
- deploy
- release
needs: release
if: always()
runs-on: ubuntu-latest
steps:
Expand Down
29 changes: 16 additions & 13 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
deployment_url: ${{ env.DEPLOYMENT_URL }}
45 changes: 21 additions & 24 deletions src/pages/structures/[id]/chiffres-cles/offre-de-formation.js
Original file line number Diff line number Diff line change
@@ -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 (
<Title as="h2">
Expand Down Expand Up @@ -49,8 +46,9 @@ export default function StructureOffreDeFormationPage() {
Les formations dans Parcoursup (open data)
</>
)}
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr/explore/dataset/fr-esr-cartographie_formations_parcoursup/\
table/?disjunctive.tf&disjunctive.nm&disjunctive.fl&disjunctive.amg&refine.etablissement_id_paysage=${id}&disjunctive.nmc&sort=-annee`}
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr
/explore/dataset/fr-esr-cartographie_formations_parcoursup
/table/?disjunctive.tf&disjunctive.nm&disjunctive.fl&disjunctive.amg&refine.etablissement_id_paysage=${id}&disjunctive.nmc&sort=-annee`}
canEdit={false}
/>
</Col>
Expand All @@ -62,8 +60,8 @@ table/?disjunctive.tf&disjunctive.nm&disjunctive.fl&disjunctive.amg&refine.etabl
Liste des principaux diplômes et formations préparés en open data
</>
)}
// eslint-disable-next-line max-len
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr/explore/dataset/fr-esr-principaux-diplomes-et-formations-prepares-etablissements-publics/table/?refine.etablissement_id_paysage=${id}`}
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr
/explore/dataset/fr-esr-principaux-diplomes-et-formations-prepares-etablissements-publics/table/?refine.etablissement_id_paysage=${id}`}
canEdit={false}
/>
</Col>
Expand All @@ -75,9 +73,9 @@ table/?disjunctive.tf&disjunctive.nm&disjunctive.fl&disjunctive.amg&refine.etabl
Les mentions dans Trouver Mon Master (TMM) (open data)
</>
)}
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr/explore/dataset\
/fr-esr-tmm-donnees-du-portail-dinformation-trouver-mon-master-mentions-de-master/table\
/?disjunctive.for_modalite&disjunctive.for_lic_cons&refine.etablissement_id_paysage=${id}`}
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr
/explore/dataset/fr-esr-tmm-donnees-du-portail-dinformation
-trouver-mon-master-mentions-de-master/table/?disjunctive.for_modalite&disjunctive.for_lic_cons&refine.etablissement_id_paysage=${id}`}
canEdit={false}
/>
</Col>
Expand All @@ -89,9 +87,8 @@ table/?disjunctive.tf&disjunctive.nm&disjunctive.fl&disjunctive.amg&refine.etabl
Les parcours dans Trouver Mon Master (TMM) (open data)
</>
)}
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr/explore/dataset\
/fr-esr-tmm-donnees-du-portail-dinformation-trouver-mon-master-parcours-de-format\
/table/?refine.etablissement_id_paysage=${id}`}
downloadUrl={`https://data.enseignementsup-recherche.gouv.fr
/explore/dataset/fr-esr-tmm-donnees-du-portail-dinformation-trouver-mon-master-parcours-de-format/table/?refine.etablissement_id_paysage=${id}`}
canEdit={false}
/>
</Col>
Expand Down

0 comments on commit 0fec82a

Please sign in to comment.