🐛 Add max length task and todo list name #145
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: Build & Deploy API | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Secret check | |
env: | |
YOUR_SECRET: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
if [ -z "$YOUR_SECRET" ]; then | |
echo "The secret is not defined. Exiting." | |
echo "SECRET_NOT_DEFINED=true" >> "$GITHUB_ENV" | |
else | |
echo "The secret is defined. Continuing." | |
fi | |
- name: Checkout | |
if: env.SECRET_NOT_DEFINED != 'true' | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
if: env.SECRET_NOT_DEFINED != 'true' | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
if: env.SECRET_NOT_DEFINED != 'true' | |
uses: docker/login-action@v3 | |
with: | |
username: xen0xys | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push Docker Image | |
if: env.SECRET_NOT_DEFINED != 'true' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: xen0xys/phoenix-api:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Deploy docker-compose | |
if: env.SECRET_NOT_DEFINED != 'true' | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ secrets.SERVER_ADDRESS }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_PRIVATE_KEY }} | |
source: "docker-compose.yml" | |
target: "/home/${{ secrets.SERVER_USERNAME }}/phoenix-api" | |
- name: SSH into Server and Deploy | |
if: env.SECRET_NOT_DEFINED != 'true' | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.SERVER_ADDRESS }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_PRIVATE_KEY }} | |
script: | | |
docker compose -f phoenix-api/docker-compose.yml pull | |
docker compose -f phoenix-api/docker-compose.yml down | |
export DOTENV_KEY=${{ secrets.DOTENV_KEY }} | |
export DATABASE_URL=${{ secrets.DATABASE_URL }} | |
docker compose -f phoenix-api/docker-compose.yml up -d | |
#jobs: | |
# deploy: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Secret check | |
# env: | |
# YOUR_SECRET: ${{ secrets.DOCKER_PASSWORD }} | |
# run: | | |
# if [ -z "$YOUR_SECRET" ]; then | |
# echo "The secret is not defined. Exiting." | |
# echo "SECRET_NOT_DEFINED=true" >> "$GITHUB_ENV" | |
# else | |
# echo "The secret is defined. Continuing." | |
# fi | |
# - name: Checkout | |
# if: env.SECRET_NOT_DEFINED != 'true' | |
# uses: actions/checkout@v4 | |
# - name: Set up Docker Buildx | |
# if: env.SECRET_NOT_DEFINED != 'true' | |
# uses: docker/setup-buildx-action@v3 | |
# - name: Login to Docker Hub | |
# if: env.SECRET_NOT_DEFINED != 'true' | |
# uses: docker/login-action@v3 | |
# with: | |
# username: xen0xys | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Build and Push Docker Image | |
# if: env.SECRET_NOT_DEFINED != 'true' | |
# uses: docker/build-push-action@v5 | |
# with: | |
# context: . | |
# push: true | |
# tags: xen0xys/phoenix-api:latest | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=max | |
# - name: SSH into Server and Deploy | |
# if: env.SECRET_NOT_DEFINED != 'true' | |
# uses: appleboy/ssh-action@v1.0.2 | |
# with: | |
# host: ${{ secrets.SERVER_ADDRESS }} | |
# username: ${{ secrets.SERVER_USERNAME }} | |
# key: ${{ secrets.SERVER_PRIVATE_KEY }} | |
# script: | | |
# docker pull xen0xys/phoenix-api:latest | |
# docker stop phoenix-api || true | |
# docker rm phoenix-api || true | |
# docker run -d -p 3000:3000 -e DOTENV_KEY=${{ secrets.DOTENV_KEY }} -v /home/${{ secrets.SERVER_USERNAME }}/keys:/home/keys --name phoenix-api --restart on-failure:2 xen0xys/phoenix-api |