⚠️‼️ deploy_prod → cms-mail-notification-frontend.rundgang.udk-berlin.de #10
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_prod → cms-mail-notification-frontend.rundgang.udk-berlin.de' | |
on: | |
#push: | |
# branches: [ "main" ] | |
#pull_request: | |
# branches: [ "main" ] | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: The branch, tag or SHA to checkout | |
required: true | |
default: 'main' | |
jobs: | |
deploy_prod: | |
runs-on: ubuntu-latest | |
env: | |
ssh_user: 'root' | |
ssh_host: 'cms-mail-notification-frontend.rundgang.udk-berlin.de' | |
ssh_key: ${{ secrets.SSH_RUNDGANG_UDK_BERLIN_DE }} | |
vite_matrix_server_url: ${{ secrets.VITE_MATRIX_SERVER_URL }} | |
vite_max_room_age_days: ${{ secrets.VITE_MAX_ROOM_AGE_DAYS }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
- run: printf "VITE_MATRIX_SERVER_URL=%s\n" "$vite_matrix_server_url" > .env | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
- run: npm clean-install | |
- run: npm run build --if-present | |
- run: mkdir -p ~/.ssh/ | |
- run: echo "$ssh_key" > ~/.ssh/private.key | |
- run: chmod 600 ~/.ssh/private.key | |
- run: | | |
cat > ~/.ssh/config << EOF | |
Host remote | |
HostName $ssh_host | |
User $ssh_user | |
IdentityFile ~/.ssh/private.key | |
StrictHostKeyChecking no | |
EOF | |
## ssh access is restricted to `rrsync` via remote:~/.ssh/authorized_keys | |
- name: Run rsync to securely copy the build directory to the remote host | |
run: | | |
rsync \ | |
--archive \ | |
--compress \ | |
--delete \ | |
--rsh="ssh -i ~/.ssh/private.key" \ | |
--progress \ | |
--verbose \ | |
dist/ \ | |
remote: | |