-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (29 loc) · 950 Bytes
/
deploy.yml
File metadata and controls
33 lines (29 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Deploy
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
type: environment
required: true
jobs:
deploy:
runs-on: ubuntu-24.04
environment: ${{ inputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- name: Deploy
uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
set -eux
cd ${{ secrets.PROD_SERVER_DEPLOY_DIR }}
git stash push -m "automatic CI stash"
git fetch --all
git checkout ${{ github.ref_name }}
git reset --hard origin/${{ github.ref_name }}
docker compose up -d --build