Regenerate Paws Website #20
This file contains 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: Regenerate Paws Website | |
on: | |
schedule: | |
# At 12:00, on day 10 of the month, every 4 months | |
# Giving 10 days for paws regen to be approved | |
- cron: "0 12 10 */4 *" | |
workflow_dispatch: | |
inputs: | |
text_to_print: | |
description: "Manual re-build" | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
name: regen-site | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: "3.1.11" | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Install System Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev libgit2-dev | |
sudo apt-get install -y libharfbuzz-dev libfribidi-dev | |
- name: Get requirements | |
run: make requirements | |
- name: Update Paws Submodule | |
run: | | |
make update-deps | |
- name: Get Paws requirements | |
run: | | |
remotes::install_deps('vendor/paws/paws.common', dependencies = TRUE) | |
remotes::install_local('vendor/paws/paws.common', force = TRUE) | |
shell: Rscript {0} | |
- name: Clean Up | |
run: | |
make clean-down | |
- name: Regen Paws Site | |
run: | | |
make regen-site | |
- name: Push to Website AWS S3 | |
run: | |
aws s3 sync build/mkdocs/site ${{ secrets.S3FOLDER }} --delete --quiet | |
- name: Force CloudFront to update | |
run: | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION }} --paths "/*" 2>&1 > /dev/null | |
- name: Update docs | |
run: | | |
mv build/mkdocs/site docs/ | |
# Commit all changed files back to the repository | |
- name: Commit and push changes. | |
run: | | |
if git diff --quiet && git diff --staged --quiet; then | |
echo "No changes to commit." | |
else | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
git add . | |
git commit -m "Regenerate Paws Website" | |
git push -u origin main | |
fi |