OiCMudkips is deploying victorzhou.dev #17
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 to | |
run-name: ${{ github.actor }} is deploying victorzhou.dev | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
"Deploy-Static-Site": | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set up SSH hosts and SSH identity | |
env: | |
VICTORZHOUDEV_SSH_KEY_PASSPHRASE: ${{ secrets.VICTORZHOUDEV_SSH_KEY_PASSPHRASE }} | |
run: | | |
mkdir ~/.ssh | |
ssh-keyscan "${{ secrets.VICTORZHOUDEV_SSH_HOST }}" >> ~/.ssh/known_hosts | |
SSH_KEY=`mktemp -p "${GITHUB_WORKSPACE}" id_rsaXXXXXX` | |
echo "${{ secrets.VICTORZHOUDEV_SSH_KEY }}" >> "${SSH_KEY}" | |
eval "$(ssh-agent)" | |
DISPLAY=1 SSH_ASKPASS="${GITHUB_WORKSPACE}/.github/util/print_ssh_passphrase.sh" ssh-add "${SSH_KEY}" | |
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV | |
echo "SSH_AGENT_PID=${SSH_AGENT_PID}" >> $GITHUB_ENV | |
- name: Deploy main website | |
env: | |
SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }} | |
SSH_AGENT_PID: ${{ env.SSH_AGENT_PID }} | |
run: | | |
ls "${GITHUB_WORKSPACE}/src" | |
- name: Install Python environment | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install Python dependencies | |
run: pip install -r "${GITHUB_WORKSPACE}/feed/requirements.txt" | |
- name: Generate and upload RSS feed files | |
env: | |
SSH_AUTH_SOCK: ${{ env.SSH_AUTH_SOCK }} | |
SSH_AGENT_PID: ${{ env.SSH_AGENT_PID }} | |
run: | | |
ATOM_OUTPUT_PATH="${GITHUB_WORKSPACE}/feed/atom.xml" RSS_OUTPUT_PATH="${GITHUB_WORKSPACE}/feed/rss.xml" python "${GITHUB_WORKSPACE}/feed/generate.py" | |
ssh "${{ secrets.VICTORZHOUDEV_SSH_ADDRESS }}" "mkdir /home/public/feed" | |
scp "${GITHUB_WORKSPACE}/feed/atom.xml" "${{ secrets.VICTORZHOUDEV_SSH_ADDRESS }}:/home/public/feed/" | |
scp "${GITHUB_WORKSPACE}/feed/rss.xml" "${{ secrets.VICTORZHOUDEV_SSH_ADDRESS }}:/home/public/feed/" |