iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
😽

Setting up automated deployment to WordPress on Xserver using GitHub Actions

に公開
2025/03/23
  1. Register the Xserver private key in GitHub Secrets

Refer to the official documentation:

https://docs.github.com/en/actions/reference/encrypted-secrets

  1. Create .github/actions/deploy.yml
name: deploy to xserver

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Gulp or other build tools if necessary
      # - name: gulp build
      #   uses: actions/setup-node@v1
      # - run: yarn install && yarn run build\
      - name: Install SSH key
        uses: shimataro/ssh-key-action@v2
        with:
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          known_hosts: sv1111.xserver.jp
      - name: rsync deploy
        run: rsync -vrlp -e "ssh -p 10022 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" ./dist/ username@sv1111.xserver.jp:/home/username/example.net/public_html/dist/

References


This article is a cross-post from my personal blog.
https://akinov.hatenablog.com/entry/2021/04/14/224709

Discussion