diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64a20f7..0ffe1b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,13 +55,15 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image - if: ${{ (github.ref == 'refs/heads/amogus' || github.ref == 'refs/heads/sus') && steps.lint.outcome == 'success' }} + if: ${{ steps.lint.outcome == 'success' }} uses: docker/build-push-action@v3 with: push: true - tags: ghcr.io/0d9e-tech/web:${{ github.ref == 'refs/heads/amogus' && 'staging' || 'latest' }} + tags: ghcr.io/0d9e-tech/web:${{ github.ref == 'refs/heads/sus' && 'latest' || github.ref == 'refs/heads/amogus' && 'staging' || 'dev' }} cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + ACTOR=${{ github.actor }} - name: Deploy if: ${{ (github.ref == 'refs/heads/amogus' || github.ref == 'refs/heads/sus') && steps.lint.outcome == 'success' }} diff --git a/Dockerfile b/Dockerfile index ada511a..135d2c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,10 @@ RUN deno cache src/server.deno.ts COPY static static COPY --from=blog-builder /srv/jekyll/build/ ./static/blog -ENV PATH "$PATH:/usr/games" +ENV PATH="$PATH:/usr/games" COPY ./static/amogus.cow /usr/share/cowsay/cows +ARG ACTOR +RUN sed -i "s||${ACTOR}|g" src/tg/init.deno.ts + CMD ["sh", "-c", "deno run --unstable-cron --allow-all src/server.deno.ts 2>&1 | sed -u -e \"s/$TG_BOT_TOKEN//g\" >> static/persistent/log.txt"] diff --git a/src/tg/init.deno.ts b/src/tg/init.deno.ts index b945f34..bc05fd5 100644 --- a/src/tg/init.deno.ts +++ b/src/tg/init.deno.ts @@ -124,6 +124,19 @@ export function checkStickerReaction(stickerMessageId: number) { const hashOrigins = [{ lat: 50.1005803, lon: 14.3954325 }]; +const users: Record = { + mvolfik: "Matěj", + chamik: "Kubík", + CloudMracek: "Honza", + marekmaskarinec: "Marek", + mariansam: "Marain", + Matuush: "Matúš", + ProkopRandacek: "Prokop", + WIPocket: "Adam", + topberry: "Honzak", + Ouolim: "Janek", +}; + async function postGeohash() { const upcoming = new Date(); upcoming.setHours(6); @@ -242,6 +255,12 @@ export async function init() { ); setTimeout(async () => { + const username = ''; + const name = users[username] ?? "Nějakej impostor"; + await tgCall({ + chat_id: MAIN_CHAT_ID, + text: `${name} zase kazí všechnu zábavu`, + }); await tgCall( { photo: `https://${DOMAIN}/startup.jpg?q=${bootId}`,