Published: May 17, 2020 by Noe Nieto
Ever since I learned about GitHub Actions, I’m trying to automate anything I can. This time I automated the deployment of my personal webpage. It’s very easy, just checkout and upload the changes using rsync.
name: Deploy my site on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build_and_deploy: runs-on: ubuntu-latest steps: - name: GitHub Checkout uses: actions/checkout@v1 - name: Rsync the build uses: Pendectemail@example.com env: DEPLOY_KEY: $ with: options: '--exclude-from=.rsyncexclude --delete-excluded' src: . # Remote server and path. i.e firstname.lastname@example.org:/var/www/server.com/ dest: $
Since we are using rsync, I could take advantage of the
--delete-excluded options to remove unwanted things on the server.