- 
      
- 
        Save wyan/851029e40637928787bd3fb54c4a9020 to your computer and use it in GitHub Desktop. 
    GitHub Actions Website Deployment Template
  
        
  
    
      This file contains hidden or 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: CI | |
| run-name: Zola blog deployment | |
| on: | |
| push: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: deploy | |
| steps: | |
| - name: Checkout the current branch | |
| uses: actions/checkout@v3 | |
| - name: Initialize the ssh-agent | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| - name: Install Zola | |
| run: sudo snap install zola --edge | |
| - name: Build the website | |
| run: zola build | |
| - name: Scan the host key | |
| run: mkdir -p ~/.ssh/ && ssh-keyscan -H $DEPLOY_SERVER >> ~/.ssh/known_hosts | |
| env: | |
| DEPLOY_SERVER: ${{ secrets.DEPLOY_SERVER }} | |
| - name: Deploy the website | |
| run: >- | |
| rsync -avx --delete --exclude '.ssh' public/ $DEPLOY_USERNAME@$DEPLOY_SERVER:./ | |
| env: | |
| DEPLOY_SERVER: ${{ secrets.DEPLOY_SERVER }} | |
| DEPLOY_USERNAME: ${{ secrets.DEPLOY_USERNAME }} | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment