Skip to content

Commit

Permalink
Add release identifier in build (#462)
Browse files Browse the repository at this point in the history
* Add release identifier in build

* Fix indent
  • Loading branch information
holzmaster authored Jul 28, 2024
1 parent bd58a33 commit b0683ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
RELEASE_IDENTIFIER=${{ github.sha }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ FROM oven/bun:alpine
COPY --from=runtime-dependencies /app/node_modules /app/node_modules
COPY ./ /app/

ARG RELEASE_IDENTIFIER
RUN echo "RELEASE_IDENTIFIER=$RELEASE_IDENTIFIER" >> /app/.env

ENTRYPOINT ["bun", "src/app.ts"]
9 changes: 9 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,20 @@ import * as cronService from "@/service/cron.js";
console.log(` │ ${cszBot} │ Copyright (c) ${year} Users of the CSZ`);
console.log(` └───────────┘${prodMode}`);
console.log();

if (process.env.RELEASE_IDENTIFIER) {
console.log(`Release: ${process.env.RELEASE_IDENTIFIER}`);
console.log();
}
}

log.info("Bot starting up...");
const config = await readConfig();

if (process.env.RELEASE_IDENTIFIER) {
log.info(`Release: ${process.env.RELEASE_IDENTIFIER}`);
}

if (config.sentry?.dsn) {
sentry.init({
dsn: config.sentry.dsn,
Expand Down

0 comments on commit b0683ac

Please sign in to comment.