Fix suggest logic (#16) #15
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: Deploy | |
on: | |
push: | |
branches: | |
- master | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy: | |
needs: build-and-push-image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout docker-compose.yml | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
docker-compose.yml | |
sparse-checkout-cone-mode: false | |
- name: Generate .env file | |
run: | | |
echo "BOT_TOKEN=${{ secrets.BOT_TOKEN }}" >> .env | |
- name: Copy files to VPS | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: ${{ secrets.DEPLOY_USERNAME }} | |
port: ${{ secrets.DEPLOY_PORT }} | |
key: ${{ secrets.DEPLOY_KEY }} | |
source: "./docker-compose.yml,./.env" | |
target: "~/docker-services/watch_together/" | |
- name: Deploy to VPS | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: ${{ secrets.DEPLOY_USERNAME }} | |
port: ${{ secrets.DEPLOY_PORT }} | |
key: ${{ secrets.DEPLOY_KEY }} | |
script: | | |
cd docker-services/watch_together | |
docker compose pull | |
docker compose down | |
docker compose up -d |