Skip to content
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
29 changes: 18 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ name: CI
on:
push:
branches:
- prod
- dev
Comment on lines -6 to 7

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normal la suppression lors du push en prod?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

justement le but, on ne déclenche plus le deploy par un push sur la prod, mais par un tag

tags:
- 'v*'
pull_request:
branches:
- prod
- dev
- prod

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
Expand Down Expand Up @@ -68,7 +69,7 @@ jobs:

build-api:
runs-on: self-hosted
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' || github.event_name == 'push'
needs:
- lint-api
steps:
Expand Down Expand Up @@ -97,7 +98,7 @@ jobs:

build-front:
runs-on: self-hosted
if: github.event_name == 'pull_request'
if: github.event_name == 'pull_request' || github.event_name == 'push'
needs:
- lint-front
steps:
Expand Down Expand Up @@ -126,10 +127,11 @@ jobs:

deploy-api:
runs-on: self-hosted
if : github.event_name == 'push'
environment: ${{ github.ref == 'refs/heads/dev' && 'development' || 'production' }}
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || startswith(github.ref, 'refs/tags/v'))
environment: ${{ startswith(github.ref, 'refs/tags/') && 'production' || 'development' }}
needs:
- lint-api
- build-api
steps:
- name: Checkout repository
uses: actions/checkout@v5
Expand All @@ -150,14 +152,16 @@ jobs:
context: ./backend
push: true
tags: |
${{ secrets.REGISTRY_URL }}/integration/api:${{ github.ref == 'refs/heads/prod' && 'prod' || 'dev' }}
${{ secrets.REGISTRY_URL }}/integration/api:${{ startswith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
${{ startswith(github.ref, 'refs/tags/') && format('{0}/integration/api:prod', secrets.REGISTRY_URL) || '' }}

deploy-front:
runs-on: self-hosted
if : github.event_name == 'push'
environment: ${{ github.ref == 'refs/heads/dev' && 'development' || 'production' }}
if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || startswith(github.ref, 'refs/tags/v'))
environment: ${{ startswith(github.ref, 'refs/tags/') && 'production' || 'development' }}
needs:
- lint-front
- build-front
steps:
- name: Checkout repository
uses: actions/checkout@v5
Expand All @@ -172,7 +176,7 @@ jobs:
- name: Install docker
uses: docker/setup-buildx-action@v3

- name: Front- Build and push
- name: Front - Build and push
uses: docker/build-push-action@v6
with:
context: ./frontend
Expand All @@ -199,5 +203,8 @@ jobs:
VITE_BDE_SIREN=${{ vars.BDE_SIREN }}
VITE_DPO_EMAIL=${{ vars.DPO_EMAIL }}
VITE_DPO_NAME=${{ vars.DPO_NAME }}
VITE_APP_VERSION=${{ startswith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
VITE_RELEASE_URL=${{ startswith(github.ref, 'refs/tags/') && format('https://github.com/{0}/releases/tag/{1}', github.repository, github.ref_name) || '' }}
tags: |
${{ secrets.REGISTRY_URL }}/integration/front:${{ github.ref == 'refs/heads/prod' && 'prod' || 'dev' }}
${{ secrets.REGISTRY_URL }}/integration/front:${{ startswith(github.ref, 'refs/tags/') && github.ref_name || 'dev' }}
${{ startswith(github.ref, 'refs/tags/') && format('{0}/integration/front:prod', secrets.REGISTRY_URL) || '' }}
4 changes: 4 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ARG VITE_BDE_SIRET=""
ARG VITE_BDE_SIREN=""
ARG VITE_DPO_EMAIL=""
ARG VITE_DPO_NAME=""
ARG VITE_APP_VERSION=""
ARG VITE_RELEASE_URL=""

ENV VITE_CAS_LOGIN_URL=${VITE_CAS_LOGIN_URL}
ENV VITE_SERVICE_URL=${VITE_SERVICE_URL}
Expand All @@ -44,6 +46,8 @@ ENV VITE_BDE_SIRET=${VITE_BDE_SIRET}
ENV VITE_BDE_SIREN=${VITE_BDE_SIREN}
ENV VITE_DPO_EMAIL=${VITE_DPO_EMAIL}
ENV VITE_DPO_NAME=${VITE_DPO_NAME}
ENV VITE_APP_VERSION=${VITE_APP_VERSION}
ENV VITE_RELEASE_URL=${VITE_RELEASE_URL}

# COPY package.json package-lock.json ./
# RUN npm install -g npm@latest
Expand Down
63 changes: 57 additions & 6 deletions frontend/src/components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,70 @@
export const Footer = () => {
const currentYear = new Date().getFullYear();
const APP_VERSION = import.meta.env.VITE_APP_VERSION;
const RELEASE_URL = import.meta.env.VITE_RELEASE_URL;
const SERVICE_URL = import.meta.env.VITE_SERVICE_URL;
const envType =
!RELEASE_URL || !APP_VERSION
? SERVICE_URL.includes('localhost') || SERVICE_URL.includes('127.0.0.1')
? 'local'
: 'dev'
: 'production';

return (
<footer className="bg-gray-800 text-white p-8 pb-4 text-center">
<div className="flex flex-col items-center gap-2">
<p className="font-semibold">Intégration UTT, un projet du <a href="https://bde.utt.fr" target="_blank" rel="noopener noreferrer" className="text-blue-400 hover:underline">BDE UTT</a></p>
<p className="font-semibold">
Intégration UTT, un projet du{' '}
<a
href="https://bde.utt.fr"
target="_blank"
rel="noopener noreferrer"
className="text-blue-400 hover:underline">
BDE UTT
</a>
</p>
<div className="flex gap-6 mt-1 text-sm">
<a href="/legals" className="text-blue-400 hover:underline">Mentions légales</a>
<a href="/privacy" className="text-blue-400 hover:underline">Politique de confidentialité</a>
<a href="/legals" className="text-blue-400 hover:underline">
Mentions légales
</a>
<a href="/privacy" className="text-blue-400 hover:underline">
Politique de confidentialité
</a>
</div>
<div className="flex gap-6 mt-1 text-sm">
{envType === 'local' ? (
<p className="bg-orange-500 py-1 px-3 rounded-md">Environnement local</p>
) : envType === 'dev' ? (
<p className="bg-yellow-500 py-1 px-3 rounded-md">Environnement de développement</p>
) : (
<a href={RELEASE_URL} target="_blank" rel="noopener noreferrer" className="hover:underline">
Version {APP_VERSION.split('v')[1]}
</a>
)}
</div>
<div className="flex justify-around w-full">
<p>&copy; {currentYear} Semaine d'Intégration UTT - <a href="https://bde.utt.fr" target="_blank" rel="noopener noreferrer" className="text-blue-400 hover:underline">BDE UTT</a></p>
<p>Hébergé et maintenu par <a href="https://uttnetgroup.fr" target="_blank" rel="noopener noreferrer" className="text-blue-400 hover:underline">UTT Net Group</a></p>
<p>
&copy; {currentYear} Semaine d'Intégration UTT -{' '}
<a
href="https://bde.utt.fr"
target="_blank"
rel="noopener noreferrer"
className="text-blue-400 hover:underline">
BDE UTT
</a>
</p>
<p>
Hébergé et maintenu par{' '}
<a
href="https://uttnetgroup.fr"
target="_blank"
rel="noopener noreferrer"
className="text-blue-400 hover:underline">
UTT Net Group
</a>
</p>
</div>
</div>
</footer>
);
}
};
Loading