Skip to content

Commit fc0fee9

Browse files
committed
Set VITE_GIT_COMMIT at build
1 parent 4af6ac3 commit fc0fee9

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.github/workflows/build-with-public-url.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ jobs:
2323
- name: Install dependencies
2424
run: npm ci
2525
- name: Build site
26-
run: BASE_URL=${BASE_URL} npm run build
26+
run: VITE_GIT_COMMIT=${VITE_GIT_COMMIT} BASE_URL=${BASE_URL} npm run build
2727
env:
2828
BASE_URL: ${{ github.event.inputs.public_url }}
29+
VITE_GIT_COMMIT: ${{ steps.artifact-vars.outputs.sha_short }}
2930
- name: Upload artifact
3031
uses: actions/upload-artifact@v4
3132
with:

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ jobs:
2525
run: npm ci
2626
shell: bash
2727
- name: Build the Docker image
28-
run: BASE_URL=/admin-tool npm run docker:buildx:push
28+
run: VITE_GIT_COMMIT=$(git rev-parse --short HEAD) BASE_URL=/admin-tool npm run docker:buildx:push
2929
shell: bash

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Publish to GitHub Pages
2020
run: |
2121
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
22-
BASE_URL="https://${GITHUB_REPOSITORY%/*}.github.io/${GITHUB_REPOSITORY#*/}" npm run build
22+
VITE_GIT_COMMIT=$(git rev-parse --short HEAD) BASE_URL="https://${GITHUB_REPOSITORY%/*}.github.io/${GITHUB_REPOSITORY#*/}" npm run build
2323
npm run gh-pages -- -d build -u "github-actions-bot <[email protected]>"
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)