Skip to content

Merge branch 'main' into production #28

Merge branch 'main' into production

Merge branch 'main' into production #28

Workflow file for this run

name: deploy
on:
push:
branches: ["production"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🗃️ Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: 📦 Build image
uses: docker/build-push-action@v4
with:
context: .
outputs: type=docker,dest=./web-client.tar
tags: sinzak-web
cache-from: type=gha
cache-to: type=gha,mode=max
- name: 📦 Ship image archive to remote server
uses: appleboy/scp-action@master
with:
username: ec2-user
host: ${{ secrets.HOST_DEV }}
key: ${{ secrets.SSH_PEM_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
source: "./web-client.tar"
target: "/home/ec2-user/deploy-web"
strip_components: 0
- name: Deploy
uses: appleboy/ssh-action@master
id: deploy-prod
with:
host: ${{ secrets.HOST_DEV }}
username: ec2-user
key: ${{ secrets.SSH_PEM_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
port: 22
script: |
cd ./deploy-web
docker load --input ./web-client.tar
docker container stop sinzak-web
docker run -d --rm -p 3000:3000 --name sinzak-web sinzak-web