Copy the pages in www/html/wordle to /var/www/html/wordle on the server, where nginx serves them from, on every deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
931 B
YAML
35 lines
931 B
YAML
name: Deploy game to server
|
|
|
|
on:
|
|
workflow_dispatch: # Allows manual execution
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up SSH key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.DEPLOY_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H "${{ vars.REMOTE_SERVER }}" >> ~/.ssh/known_hosts
|
|
chmod 644 ~/.ssh/known_hosts
|
|
|
|
- name: Transfer file via SCP
|
|
run: |
|
|
scp -i ~/.ssh/id_rsa wordle ${{ vars.REMOTE_USER }}@${{ vars.REMOTE_SERVER }}:${{ vars.REMOTE_DEST }}
|
|
|
|
- name: Transfer web pages via SCP
|
|
run: |
|
|
scp -i ~/.ssh/id_rsa www/html/wordle/* ${{ vars.REMOTE_USER }}@${{ vars.REMOTE_SERVER }}:/var/www/html/wordle/
|
|
|
|
- name: Clean up SSH key
|
|
run: rm -rf ~/.ssh
|