Skip to content

Commit

Permalink
Merge pull request #464 from nordic-rse/radovan/preview
Browse files Browse the repository at this point in the history
update, simplify, and better name and file name
  • Loading branch information
bast authored Aug 29, 2024
2 parents 39e17d1 + 0419386 commit 4672bbe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
name: Build/deploy website

env:
ZOLA_VERSION: "0.17.2"
ZOLA_VERSION: "0.18.0"
MAIN_BRANCH: "main"
TARGET_BRANCH: "gh-pages"
CNAME: "nordic-rse.org"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: PR Comment # Write a comment in the PR with a link to the preview of the given website
name: Link to preview in PR conversation
on:
pull_request:
types: [opened, reopened]
jobs:
pr_comment:
link-to-preview:
runs-on: ubuntu-latest
steps:
- name: Create PR comment
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name # if this is a pull request build AND the pull request is NOT made from a fork
uses: thollander/actions-comment-pull-request@71efef56b184328c7ef1f213577c3a90edaa4aff
with:
message: 'Once the build has completed, you can preview your PR at this URL: https://${{ github.event.pull_request.base.repo.name }}/previews/PR${{ github.event.number }}/'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# from https://github.com/CliMA/ClimaTimeSteppers.jl
name: Site Preview Cleanup
name: Remove preview once PR is merged or closed

on:
pull_request:
types: [closed]

jobs:
doc-preview-cleanup:
remove-preview-after-merge:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Delete preview and history + push changes
run: |
if [ -d "previews/PR$PRNUM" ]; then
git config user.name "Documenter.jl"
git config user.email "[email protected]"
git rm -rf "previews/PR$PRNUM"
if [ -d "previews/PR${{ github.event.number }}" ]; then
git config user.name "GH workflow"
git config user.email "[email protected]"
git rm -rf "previews/PR${{ github.event.number }}"
git commit -m "delete preview"
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
git push --force origin gh-pages-new:gh-pages
fi
env:
PRNUM: ${{ github.event.number }}

0 comments on commit 4672bbe

Please sign in to comment.