Merge pull request #549 from hanshino:feature/adjust-gemini #401
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: redive linebot CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
# Backend build and push job | |
backend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Backend build and push Docker image | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 | |
with: | |
context: ./app | |
push: true | |
tags: hanshino/redive_backend:latest | |
cache-from: type=registry,ref=hanshino/redive_backend:buildcache | |
cache-to: type=registry,ref=hanshino/redive_backend:buildcache,mode=max | |
# Frontend build and push job, executed in parallel with backend | |
frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Frontend build and push Docker image | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 | |
with: | |
context: ./frontend | |
push: true | |
tags: hanshino/redive_frontend:latest | |
cache-from: type=registry,ref=hanshino/redive_frontend:buildcache | |
cache-to: type=registry,ref=hanshino/redive_frontend:buildcache,mode=max | |
build-args: | | |
REACT_APP_GOOGLE_ANALYTICS_ID=${{ secrets.GOOGLE_ANALYTICS_ID }} | |
# Deployment job, dependent on both backend and frontend build completion | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [backend, frontend] # Ensure that both backend and frontend jobs are finished before deploying | |
steps: | |
- name: Deploy Redive linebot | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script: | | |
cd ${{ secrets.DEPLOY_PATH }} | |
git pull | |
bash scripts/run-tasks.sh traefik-run | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: "{{ EVENT_PAYLOAD.repository.full_name }} 已完成部署" |