From ba10a33b7823d127b3d1f3a58a1bfbc242a0c642 Mon Sep 17 00:00:00 2001 From: nfrerebeau Date: Tue, 27 Aug 2024 14:13:10 +0200 Subject: [PATCH] Update GitHub Actions workflow --- .github/workflows/render.yaml | 55 ++++++++++++++++++++++++++++++----- .nojekyll | 0 CNAME | 1 - 3 files changed, 47 insertions(+), 9 deletions(-) delete mode 100644 .nojekyll delete mode 100644 CNAME diff --git a/.github/workflows/render.yaml b/.github/workflows/render.yaml index de5bb44a4..469e12f9e 100644 --- a/.github/workflows/render.yaml +++ b/.github/workflows/render.yaml @@ -55,7 +55,8 @@ jobs: Rscript -e 'utils::install.packages(pkgs = ".", repos = NULL)' Rscript -e 'pkgdown::build_site_github_pages(pkg = ".", dest_dir = "docs")' - - uses: actions/upload-artifact@v4 + - name: Upload pkgdown artifacts + uses: actions/upload-artifact@v4 with: name: ${{ matrix.config.pkg }} path: tmp/docs @@ -65,7 +66,7 @@ jobs: if: ${{ always() }} needs: pkgdown env: - GITHUB_PAT: ${{ secrets.TOKEN }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 @@ -84,10 +85,48 @@ jobs: with: path: _site - - name: Deploy to GitHub pages 🚀 - if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@v4.6.0 + - name: Upload website artifacts + uses: actions/upload-artifact@v4 with: - clean: true - branch: gh-pages - folder: _site + name: quarto + path: _site + + deploy: + runs-on: ubuntu-latest + needs: quarto + env: + USER: ${{ secrets.DEPLOY_USER }} + SERVER: ${{ secrets.DEPLOY_HOST }} + REPO: ${{ secrets.DEPLOY_REPOSITORY }} + KEY: ${{ secrets.SSH_PRIVATE_KEY }} + steps: + - name: Download website artifacts + uses: actions/download-artifact@v4 + with: + name: quarto + path: htdocs + + - name: Add SSH key + run: | + mkdir -p ~/.ssh + chmod 700 ~/.ssh + echo "${KEY}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan ${SERVER} >> ~/.ssh/known_hosts + chmod 644 ~/.ssh/known_hosts + + - name: Push to production + run: | + git init -b main + git config --global user.email "packages@tesselle.org" + git config --global user.name "tesselle" + git remote add production ssh+git://${USER}@${SERVER}/${REPO} + git add * + git commit -m "Built site" + git push -f production main + + - name: Deploy + run: ssh ${USER}@${SERVER} deploy ${REPO} main + + - name: Clean + run: ssh ${USER}@${SERVER} clean ${REPO} main diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29bb..000000000 diff --git a/CNAME b/CNAME deleted file mode 100644 index 3059d740d..000000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -packages.tesselle.org