Skip to content

Commit

Permalink
versioning tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam committed Jul 26, 2023
1 parent fd3ab99 commit 751bdfd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ jobs:
DOCKER_METADATA_PR_HEAD_SHA: true

- name: get date
run: echo "BUILD_TIMESTAMP=$(git show -s --format=%cI)" >> $GITHUB_ENV
run: echo "GIT_TIMESTAMP=$(git show -s --format=%cI)" >> $GITHUB_ENV

- uses: docker/build-push-action@v4
with:
build-args: |
VITE_APP_GIT_SHA=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
VITE_APP_BUILD_TIMESTAMP=${{ env.BUILD_TIMESTAMP }}
VITE_APP_GIT_TIMESTAMP=${{ env.GIT_TIMESTAMP }}
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_RELEASE=${{ github.event_name == 'push' && github.sha || github.event.pull_request.head.sha }}
builder: ${{ steps.buildx.outputs.name }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ ADD . ./
RUN pnpm install --offline

ARG VITE_APP_GIT_SHA=unknown
ARG VITE_APP_BUILD_TIMESTAMP=1970-01-01T00:00:00Z
ARG VITE_APP_COMMIT_TIMESTAMP=1970-01-01T00:00:00Z
ARG SENTRY_AUTH_TOKEN
ARG SENTRY_RELEASE
ENV VITE_APP_GIT_SHA $VITE_APP_GIT_SHA
ENV VITE_APP_BUILD_TIMESTAMP $VITE_APP_BUILD_TIMESTAMP
ENV VITE_APP_COMMIT_TIMESTAMP $VITE_APP_COMMIT_TIMESTAMP
ENV SENTRY_AUTH_TOKEN $SENTRY_AUTH_TOKEN
ENV SENTRY_RELEASE $SENTRY_RELEASE
RUN pnpm build:production
Expand Down
2 changes: 1 addition & 1 deletion go/build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
cd "$(dirname "$0")"
docker compose build --build-arg VITE_APP_GIT_SHA=$(git show -s --format=%H) --build-arg VITE_APP_BUILD_TIMESTAMP=$(git show -s --format=%cI)
docker compose build --build-arg VITE_APP_GIT_SHA=$(git show -s --format=%H) --build-arg VITE_APP_COMMIT_TIMESTAMP=$(git show -s --format=%cI)
2 changes: 1 addition & 1 deletion src/components/ErrorFallback.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ErrorFallback = ({ error, componentStack }) => {
}, []);

const information = `connect version: ${import.meta.env.VITE_APP_GIT_SHA || 'unknown'}
Build timestamp: ${import.meta.env.VITE_APP_BUILD_TIMESTAMP || 'unknown'}
Build timestamp: ${import.meta.env.VITE_APP_COMMIT_TIMESTAMP || 'unknown'}
URL: ${window.location.href}
Browser: ${window.navigator.userAgent}
Expand Down
8 changes: 5 additions & 3 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ if (window.SENTRY_ENV) {
});
}

console.info('Mode:', import.meta.env.MODE || 'unknown');
console.info('App version:', import.meta.env.VITE_APP_GIT_SHA || 'dev');
console.info('Build timestamp:', import.meta.env.VITE_APP_BUILD_TIMESTAMP || 'unknown');
console.info('mode:', import.meta.env.MODE || 'unknown');
console.info('connect version:', import.meta.env.VITE_APP_GIT_SHA || 'dev');
if (import.meta.env.VITE_APP_GIT_COMMIT_TIMESTAMP) {
console.info('commit date:', import.meta.env.VITE_APP_GIT_COMMIT_TIMESTAMP || 'unknown');
}

ReactDOM.createRoot(document.getElementById('root')).render((
<MuiThemeProvider theme={Theme}>
Expand Down

0 comments on commit 751bdfd

Please sign in to comment.