Skip to content

frontend-cd

frontend-cd #62

Workflow file for this run

name: frontend-cd
on:
workflow_run:
workflows:
- frontend-ci
types:
- completed
branches:
- main
workflow_call:
inputs:
environment:
type: string
required: true
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: frontend-artifact
path: frontend-artifact
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Copy files to host
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
source: frontend-artifact
target: /home/${{ secrets.SSH_USERNAME }}/
- name: Deployment
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
script: |
git clone https://github.com/${{ github.repository }} repo-tmp --depth=1
mkdir -p repo
cp -r repo-tmp/* repo
rm -rf repo-tmp
cp -r frontend-artifact repo/frontend/docker
cd repo
docker compose down
docker compose up --build -d