Skip to content

Update GitHub Actions workflow #71

Update GitHub Actions workflow

Update GitHub Actions workflow #71

Workflow file for this run

# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main]
name: render
jobs:
quarto:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-r-dependencies@v2
- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Render quarto project
uses: quarto-dev/quarto-actions/render@v2
- name: Upload website artifacts
uses: actions/upload-artifact@v4
with:
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
- name: Deploy
run: |
## Create the SSH directory and give it the right permissions
mkdir -p ~/.ssh
chmod 700 ~/.ssh
## Add the SSH key
echo "$KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
## Use ssh-keyscan to scan the keys of the server
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
## Push
git remote -v | grep -w production || git remote add production ssh+git://$USER@$HOST/$REPO
git push -f production master
ssh $USER@$HOST deploy $REPO
ssh $USER@$HOST clean $REPO