😽
GitHub ActionsでXserverにあるWPに自動デプロイを設定する
1.GitHubのSecretsにXserverの秘密鍵を登録する
公式を参考
2..github/actions/deploy.yml
作成
name: deploy to xserver
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# 必要に応じてgulpなど
# - 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/
参考
※こちらの記事は自ブログからの転載です
Discussion