From 667d3942a6e099fe0368abfacf9feaccaa2acf2a Mon Sep 17 00:00:00 2001 From: "Daniel F. Dickinson" Date: Mon, 8 Aug 2022 23:51:49 -0400 Subject: [PATCH] Update workflow to use rclone deploy Signed-off-by: Daniel F. Dickinson --- .github/workflows/build-and-verify.yml | 35 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-and-verify.yml b/.github/workflows/build-and-verify.yml index e5bc3cf..6b285fd 100644 --- a/.github/workflows/build-and-verify.yml +++ b/.github/workflows/build-and-verify.yml @@ -82,7 +82,7 @@ jobs: - build-minified-site - validate-unminified-html - check-links - environment: minimal-test-production + environment: production runs-on: ubuntu-20.04 if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} steps: @@ -94,12 +94,27 @@ jobs: env: DOWNLOAD_SITE_FILENAME: hugo-site.tar run: tar -xf "${DOWNLOAD_SITE_FILENAME}" - - name: "Deploy Minified Site" - uses: wlixcc/SFTP-Deploy-Action@v1.0 - with: - local_path: './public/*' - port: ${{ secrets.DEPLOY_SFTP_PORT }} - server: ${{ secrets.DEPLOY_SFTP_HOSTNAME }} - ssh_private_key: ${{ secrets.DEPLOY_PRIVATE_KEY }} - remote_path: ${{ secrets.DEPLOY_SFTP_REMOTE_PATH }} - username: ${{ secrets.DEPLOY_SFTP_USERNAME }} + - name: "Install Rclone" + run: | + sudo apt-get update + sudo apt-get install rclone + - name: "Deploy minified site (rclone sync)" + shell: bash + env: + RCLONE_ONE_FILE_SYSTEM: "true" + RCLONE_ERROR_ON_NO_TRANSFER: "true" + RCLONE_SFTP_SKIP_LINKS: "true" + RCLONE_SFTP_KEY_FILE_PASS: "${{ secrets.DEPLOY_SFTP_KEY_PASS }}" + RCLONE_SFTP_PORT: ${{ secrets.DEPLOY_SFTP_PORT }} + RCLONE_SFTP_HOST: ${{ secrets.DEPLOY_SFTP_HOSTNAME }} + SFTP_KEY_PEM: "${{ secrets.DEPLOY_SFTP_PRIVATE_KEY }}" + REMOTE_PATH: "${{ secrets.DEPLOY_SFTP_REMOTE_PATH }}" + RCLONE_SFTP_USER: ${{ secrets.DEPLOY_SFTP_USERNAME }} + run: | + eval "$(ssh-agent)" + umask 177 + echo "${SFTP_KEY_PEM}" >~/sftp-key-file + umask 0022 + export RCLONE_SFTP_KEY_FILE=~/sftp-key-file + export RCLONE_ONE_FILE_SYSTEM RCLONE_ERROR_ON_NO_TRANSFER RCLONE_SFTP_SKIP_LINKS RCLONE_SFTP_KEY_FILE_PASS RCLONE_SFTP_PORT RCLONE_SFTP_HOST REMOTE_PATH RCLONE_SFTP_USER + rclone sync public/ :sftp:${REMOTE_PATH}