Adding GIT_COMMIT to see hash in server
This commit is contained in:
parent
d9ed2f22c1
commit
ce81225260
3 changed files with 18 additions and 1 deletions
8
.github/workflows/main.yml
vendored
8
.github/workflows/main.yml
vendored
|
|
@ -16,6 +16,10 @@ jobs:
|
|||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USERNAME }}
|
||||
password: ${{ secrets.GHCR_PASSWORD }}
|
||||
- name: Declare GIT_COMMIT
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GIT_COMMIT=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
|
||||
- name: Build docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
|
|
@ -24,4 +28,6 @@ jobs:
|
|||
push: true
|
||||
tags: ghcr.io/cgduncan7/autobaan:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
cache-to: type=gha,mode=max
|
||||
build-args:
|
||||
- GIT_COMMIT: ${{ env.GIT_COMMIT }}
|
||||
|
|
@ -23,4 +23,9 @@ COPY --chown=node:node tsconfig.json tsconfig.json
|
|||
RUN CXX=g++-12 npm install
|
||||
|
||||
RUN npm run migrations
|
||||
|
||||
ARG GIT_COMMIT
|
||||
|
||||
ENV GIT_COMMIT ${GIT_COMMIT:-unknown}
|
||||
|
||||
ENTRYPOINT ["npm", "run", "start"]
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { InjectQueue, Process, Processor } from '@nestjs/bull'
|
||||
import { Inject, Injectable, OnApplicationBootstrap } from '@nestjs/common'
|
||||
import { ConfigService } from '@nestjs/config'
|
||||
import { Job, JobOptions, Queue } from 'bull'
|
||||
import { Dayjs } from 'dayjs'
|
||||
|
||||
|
|
@ -15,6 +16,9 @@ import {
|
|||
@Injectable()
|
||||
export class NtfyProvider implements OnApplicationBootstrap {
|
||||
constructor(
|
||||
@Inject(ConfigService)
|
||||
private readonly configService: ConfigService,
|
||||
|
||||
@Inject(NtfyClient)
|
||||
private readonly ntfyClient: NtfyClient,
|
||||
|
||||
|
|
@ -49,9 +53,11 @@ export class NtfyProvider implements OnApplicationBootstrap {
|
|||
}
|
||||
|
||||
async sendBootstrappedNotification() {
|
||||
const gitCommit = this.configService.get<string>('GIT_COMMIT')
|
||||
await this.publishQueue.add(
|
||||
...NtfyProvider.defaultJob({
|
||||
title: 'Autobaan up and running',
|
||||
message: `Version ${gitCommit}`,
|
||||
tags: [MessageTags.badminton],
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue