Skip to content

Davide/test workflows #3

Davide/test workflows

Davide/test workflows #3

name: Create PR preview
on:
pull_request:
types:
- opened
- reopened
- synchronize
concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-deploy-preview:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Python setup
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build preview website
run: mkdocs build -f mkdocs.yml -d pr_preview-${{ github.ref }}
- name: Add preview on gh-pages branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: pr_preview-${{ github.ref }}
target-folder: pr_preview/pr-${{ github.ref }}
commit-message: Deploy preview for PR ${{ github.ref }} 🛫
force: false
# - name: Deploy to Github pages
- name: Get date
run: echo "DATE=$(date +'%Y-%m-%dT%H:%M')" >> $GITHUB_ENV
- name: Leave a comment after deployment
# if: env.deployment_status == 'success'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-preview
number: ${{ github.event.number }}
message: "\
PR Preview
:---:
🛫 Deployed preview to
https://access-hive.org.au/pr_preview/pr-${{ github.event.number }}
on branch [gh-pages]\
(${{ github.server_url }}/${{ github.repository }}/tree/gh-pages)
$DATE
"
# - name: Deploy preview
# uses: access-nri/[email protected]
# with:
# source-dir: pr_preview-${{ github.ref }}
# action: deploy
# pr-number: ${{ github.event.number }}