6363 id : get-version
6464 run : echo "VERSION=$(git describe --tags --abbrev=0 | cut -c2-)" >> "$GITHUB_OUTPUT"
6565
66+ build-ui-envs :
67+ needs : ["release"]
68+ if : needs.release.outputs.VERSION != needs.release.outputs.PREV_VERSION
69+ runs-on : ubuntu-latest
70+ strategy :
71+ matrix :
72+ env : [recette, pentest]
73+ steps :
74+ - name : Checkout project
75+ uses : actions/checkout@v5
76+ with :
77+ fetch-depth : 0
78+
79+ - uses : actions/setup-node@v6
80+ with :
81+ node-version : 24
82+ cache : " yarn"
83+
84+ - name : Install dependencies
85+ run : yarn install --immutable
86+
87+ - name : Set up Docker Buildx
88+ uses : docker/setup-buildx-action@v3
89+ with :
90+ platforms : linux/amd64
91+ install : true
92+
93+ - name : Login to GitHub Container Registry
94+ uses : docker/login-action@v3
95+ with :
96+ registry : ghcr.io
97+ username : ${{ github.actor }}
98+ password : ${{ secrets.GITHUB_TOKEN }}
99+
100+ - name : Expose GitHub Runtime
101+ uses : crazy-max/ghaction-github-runtime@v2
102+
103+ - name : Build UI ${{ matrix.env }}
104+ run : .bin/scripts/build-images.sh ${{ needs.release.outputs.VERSION }} push $(git rev-parse HEAD) ${{ matrix.env }}
105+ env :
106+ CI : true
107+
66108 docker-scout-server :
67109 if : needs.release.outputs.VERSION != needs.release.outputs.PREV_VERSION
68110 needs : ["release"]
@@ -120,7 +162,7 @@ jobs:
120162 deploy-recette :
121163 concurrency :
122164 group : " deploy-${{ github.workflow }}-${{ github.ref }}"
123- needs : ["release"]
165+ needs : ["release", "build-ui-envs" ]
124166 name : Deploy ${{ needs.release.outputs.VERSION }} on recette
125167 uses : " ./.github/workflows/_deploy.yml"
126168 with :
@@ -135,7 +177,7 @@ jobs:
135177 deploy-pentest :
136178 concurrency :
137179 group : " deploy-pentest-${{ github.workflow }}-${{ github.ref }}"
138- needs : ["release"]
180+ needs : ["release", "build-ui-envs" ]
139181 name : Deploy ${{ needs.release.outputs.VERSION }} on pentest
140182 uses : " ./.github/workflows/_deploy.yml"
141183 with :
@@ -157,27 +199,23 @@ jobs:
157199 fetch-depth : 0
158200 persist-credentials : true
159201
160- - uses : actions/setup-node@v6
161- with :
162- node-version : 24
163- cache : " yarn"
164-
165- - name : Install dependencies
166- run : yarn install --immutable
167-
168- - name : Build sourcemaps
169- run : yarn build
170- env :
171- NEXT_PUBLIC_ENV : production
172- NEXT_PUBLIC_VERSION : ${{ needs.release.outputs.VERSION }}
173-
174202 - name : Login to GitHub Container Registry
175203 uses : docker/login-action@v3
176204 with :
177205 registry : ghcr.io
178206 username : ${{ github.actor }}
179207 password : ${{ secrets.GITHUB_TOKEN }}
180208
209+ - name : Pull UI production image
210+ run : docker pull ghcr.io/mission-apprentissage/mna_lba_ui:${{ needs.release.outputs.VERSION }}-production
211+
212+ - name : Extract sourcemaps from Docker image
213+ run : |
214+ docker create --name temp-ui ghcr.io/mission-apprentissage/mna_lba_ui:${{ needs.release.outputs.VERSION }}-production
215+ mkdir -p ui/.next
216+ docker cp temp-ui:/app/ui/.next/static ./ui/.next/static
217+ docker rm temp-ui
218+
181219 - name : Create vault pwd file
182220 run : echo ${{ secrets.VAULT_PWD }} > .infra/.vault_pwd.txt
183221
0 commit comments