diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e2c62c4 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,80 @@ +name: Deploy + +on: + workflow_dispatch: + push: + branches: + - main + +permissions: + contents: write + pages: write + id-token: write + pull-requests: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: | + sysfonts + ggplot2 + ggtext + showtext + knitr + webshot2 + + - uses: quarto-dev/quarto-actions/setup@v2 + with: + version: pre-release + tinytex: true + + - name: Render Quarto Project + shell: bash + run: | + quarto render template.qmd --to coeos-revealjs --output index.html --output-dir _site + + - uses: actions/configure-pages@v5 + + - uses: actions/upload-pages-artifact@v3 + with: + path: '_site' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + + - name: Update Screenshot + shell: bash + run: | + BRANCH=ci/update-thumbs + if git show-ref --quiet refs/heads/${BRANCH}; then + echo "Branch ${BRANCH} already exists." + git branch -D "${BRANCH}" + git push origin --delete "${BRANCH}" + fi + git checkout -b "${BRANCH}" + Rscript -e "webshot2::webshot(url = \"_site/index.html\", file = \"template.png\", vwidth = 1920, vheight = 1080)" + git config --local user.name github-actions[bot] + git config --local user.email 41898282+github-actions[bot]@users.noreply.github.com + git add template.png + git commit -m "ci: update thumbs" + git push --force origin ${BRANCH} + gh pr create --fill-first --base "main" --head "${BRANCH}" + gh pr merge --auto --squash --delete-branch diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 1ca49c9..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,69 +0,0 @@ -on: - push: - branches: main - workflow_dispatch: - -name: Quarto Publish - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -jobs: - build-deploy: - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v2 - - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - packages: | - sysfonts - ggplot2 - ggtext - showtext - knitr - webshot2 - - name: Set up Quarto - uses: quarto-dev/quarto-actions/setup@v2 - - name: Render and Publish - run: | - [ -d index ] || mkdir index - if grep -E "^index/$" .gitignore ; then - echo "index already in .gitignore" - else - echo "Add index to .gitignore" - echo "\nindex/" >> .gitignore - fi - cd index - quarto use template --no-prompt ${{ github.repository }} - git config --global user.email "${{ github.actor }}@users.noreply.github.com" - git config --global user.name "${{ github.actor }}" - quarto publish gh-pages index.qmd - cd .. - Rscript -e "webshot2::webshot(url = \"index/index.html\", file = \"template.png\", vwidth = 1920, vheight = 1080)" - rm -rf index - # git add template.png - # git commit -m "ci: update thumbs" || echo "No changes to commit" - # git push origin || echo "No changes to commit" - - name: Create Pull Request - id: cpr - uses: peter-evans/create-pull-request@v4 - with: - add-paths: template.png - commit-message: "ci: update thumbs" - signoff: false - branch: ci/latest-quarto-updates - delete-branch: true - title: "ci: update thumbs" - author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> - committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> - - name: Render and Publish - if: ${{ false }} - uses: quarto-dev/quarto-actions/publish@v2 - with: - target: gh-pages - path: template.qmd