From bbe8f32b969f1961be04f8cf5a479abe125aaf12 Mon Sep 17 00:00:00 2001 From: Laurent Bossavit Date: Fri, 15 Nov 2024 14:57:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7(build)=20create=20version.json=20f?= =?UTF-8?q?iles=20on=20both=20backend=20and=20frontend=20on=20push?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This supplements the release process. We inject Github metadata into two version.json files; the 'version' value will depend on the type of event, for release tag events it should be the same as the release tag (i.e. the app version). This should make version information available to the /config endpoint on any push, and the frontend should display the backend version. (For extra safety we will also want to get the frontend version and display that, but this commit only supplies the barest necessities.) --- .github/workflows/docker-hub.yml | 14 ++++++++++++++ src/frontend/apps/desk/.prettierignore | 1 + 2 files changed, 15 insertions(+) diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker-hub.yml index 9df3545..bde83ce 100644 --- a/.github/workflows/docker-hub.yml +++ b/.github/workflows/docker-hub.yml @@ -87,6 +87,13 @@ jobs: name: Login to DockerHub if: github.event_name != 'pull_request' run: echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USER" --password-stdin + - name: create-version-json + id: create-version-json + uses: jsdaniell/create-json@v1.2.3 + with: + name: "version.json" + json: '{"source":"${{github.repository}}", "version":"${{github.ref_name}}", "commit":"${{github.sha}}", "build": "NA"}' + dir: 'src/backend' - name: Build and push uses: docker/build-push-action@v6 @@ -127,6 +134,13 @@ jobs: with: secret-file: secrets/numerique-gouv/people/secrets.enc.env age-key: ${{ secrets.SOPS_PRIVATE }} + - name: create-version-json + id: create-version-json + uses: jsdaniell/create-json@v1.2.3 + with: + name: "version.json" + json: '{"source":"${{github.repository}}", "version":"${{github.ref_name}}", "commit":"${{github.sha}}", "build": "NA"}' + dir: 'src/frontend/apps/desk' - name: Login to DockerHub if: github.event_name != 'pull_request' diff --git a/src/frontend/apps/desk/.prettierignore b/src/frontend/apps/desk/.prettierignore index f76c765..38209bb 100644 --- a/src/frontend/apps/desk/.prettierignore +++ b/src/frontend/apps/desk/.prettierignore @@ -1 +1,2 @@ next-env.d.ts +version.json