rm preorder section #3
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 | |
env: | |
WEBSITE_NAME: laikadog.ai | |
on: | |
push: | |
branches: | |
- master | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create GitHub Deployment | |
uses: chrnorm/deployment-action@v2 | |
id: deployment | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
environment: production | |
initial-status: in_progress | |
- name: Copy files to server | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
source: "*,!.git,!.github" | |
target: "/tmp/${{ env.WEBSITE_NAME }}-deploy" | |
- name: Replace target files | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
command_timeout: "60m" | |
script: | | |
set -x | |
TARGET_DIR="/usr/share/nginx/${{ env.WEBSITE_NAME }}/html" | |
sudo rm -rf $TARGET_DIR/* | |
sudo mkdir -p $TARGET_DIR | |
sudo mv /tmp/${{ env.WEBSITE_NAME }}-deploy/* $TARGET_DIR/ | |
sudo rm -rf /tmp/${{ env.WEBSITE_NAME }}-deploy | |
- name: Update deployment status (success) | |
if: success() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
deployment-id: ${{ steps.deployment.outputs.deployment_id }} | |
state: "success" | |
environment-url: https://${{ env.WEBSITE_NAME }}/ | |
- name: Update deployment status (failure) | |
if: failure() | |
uses: chrnorm/deployment-status@v2 | |
with: | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
deployment-id: ${{ steps.deployment.outputs.deployment_id }} | |
state: "failure" |