Skip to content

Update README.md

Update README.md #202

Workflow file for this run

name: Continuous Integration and Continuous Deployment
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-push-image-and-deploy-stack:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/navaship:latest
- name: Checkout the repo
uses: actions/checkout@v3
with:
# This will create a directory named `api` and copy the repo contents to it
# so that you can easily upload it to your remote server
path: api
ref: main
- name: Copy repo to remote server
uses: appleboy/scp-action@master
with:
host: ${{ vars.VPS_HOST }}
port: ${{ vars.VPS_PORT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
source: api
target: "~/navaship"
- name: SSH and Deploy
uses: appleboy/[email protected]
with:
host: ${{ vars.VPS_HOST }}
port: ${{ vars.VPS_PORT }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
script: |
cd ~/navaship/api
docker-compose -f docker-compose.prod.yml down
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
export SPRING_PROFILES_ACTIVE="prod"
export DATABASE_NAME="${{ vars.DATABASE_NAME }}"
export DATABASE_USER="${{ vars.DATABASE_USER }}"
export DATABASE_PASSWORD="${{ secrets.DATABASE_PASSWORD }}"
export API_PORT="${{ vars.API_PORT }}"
export API_DOMAIN="${{ vars.API_DOMAIN }}"
export WEBAPP_URL="${{ vars.WEBAPP_URL }}"
export SENDGRID_SENDER_EMAIL="${{ vars.SENDGRID_SENDER_EMAIL }}"
export SENDGRID_APIKEY="${{ secrets.SENDGRID_APIKEY }}"
export EASYPOST_APIKEY="${{ secrets.EASYPOST_APIKEY }}"
export EASYPOST_WEBHOOK_ENDPOINT_URL="${{ vars.EASYPOST_WEBHOOK_ENDPOINT_URL }}"
export STRIPE_APIKEY="${{ secrets.STRIPE_APIKEY }}"
export STRIPE_WEBHOOK_ENDPOINT_URL="${{ vars.STRIPE_WEBHOOK_ENDPOINT_URL }}"
export STRIPE_PRODUCT_ID="${{ vars.STRIPE_PRODUCT_ID }}"
docker-compose -f docker-compose.prod.yml pull
docker-compose -f docker-compose.prod.yml up -d