doc.rustdesk.com/.github/workflows/deploy.yml

38 lines
1.1 KiB
YAML
Raw Normal View History

2023-07-10 08:55:26 +02:00
name: Deploy
on: [workflow_dispatch]
jobs:
2023-07-10 08:59:36 +02:00
deploy:
2023-07-10 08:55:26 +02:00
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
2023-07-10 09:21:27 +02:00
- name: Add SSH key to agent
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.SK }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan ${{ secrets.HOST }} >> ~/.ssh/known_hosts
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
2023-07-10 08:55:26 +02:00
- name: Build
run: |
2023-07-10 09:06:12 +02:00
sudo apt update -y
sudo apt install -y git
2023-07-10 09:04:49 +02:00
git clone https://github.com/matcornic/hugo-theme-learn themes/hugo-theme-learn --depth=1
2023-07-10 08:55:26 +02:00
hugo --minify
cd public; tar czf x *
2023-07-10 09:21:27 +02:00
scp x ${{ secrets.NAME }}@${{ secrets.HOST }}:/tmp/
ssh ${{ secrets.NAME }}@${{ secrets.HOST }} "sudo rm -rf /var/www/html/rustdesk.com/docs/* && sudo tar xzf /tmp/x -C /var/www/html/rustdesk.com/docs/ && /bin/rm /tmp/x && sudo chown www-data:www-data /var/www/html/rustdesk.com/docs/ -R"