mirror of
https://github.com/SrIzan10/hctv.git
synced 2026-06-06 00:56:56 +00:00
149 lines
4.6 KiB
YAML
149 lines
4.6 KiB
YAML
name: Publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
frontend:
|
|
name: Push frontend to Docker Hub
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
with:
|
|
images: srizan10/hclive
|
|
tags: latest
|
|
|
|
- name: Download latest emoji importer
|
|
run: |
|
|
RELEASE_URL=$(curl -s https://api.github.com/repos/srizan10/hctv/releases/latest | \
|
|
grep "browser_download_url.*slack-import-emojis-linux-x86_64" | \
|
|
cut -d '"' -f 4)
|
|
|
|
curl -L -o slack-import-emojis-bin $RELEASE_URL
|
|
chmod +x slack-import-emojis-bin
|
|
|
|
mkdir -p apps/web/src/lib/instrumentation/
|
|
|
|
export SLACK_TOKEN=${{ secrets.SLACK_TOKEN }}
|
|
./slack-import-emojis-bin
|
|
|
|
cp emojis.json apps/web/src/lib/instrumentation/
|
|
cp emojis.json apps/web/
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./apps/web/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64
|
|
secrets: |
|
|
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
|
|
db:
|
|
name: Push db to Docker Hub
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
with:
|
|
images: srizan10/hclive-db
|
|
tags: latest
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./packages/db/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64
|
|
secrets: |
|
|
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
|
|
chat:
|
|
name: Push chat module to Docker Hub
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
with:
|
|
images: srizan10/hclive-chat
|
|
tags: latest
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./apps/chat/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64
|
|
secrets: |
|
|
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
|
|
deploy:
|
|
name: Deploy to server
|
|
runs-on: ubuntu-latest
|
|
needs: [frontend, db, chat]
|
|
steps:
|
|
# source https://github.com/taciturnaxolotl/cachet/blob/main/.github/workflows/deploy.yaml
|
|
- name: Deploy with Docker
|
|
uses: appleboy/ssh-action@v1
|
|
with:
|
|
host: hackclub.app
|
|
username: srizan
|
|
key: ${{ secrets.SSH_KEY }}
|
|
port: 22
|
|
script: |
|
|
cd ~/compose/hctv
|
|
docker compose pull
|
|
docker compose up -d --remove-orphans
|
|
# for some reason, without the restart, the rtmp container stops working
|
|
docker compose restart |