Skip to content

Commit

Permalink
Add deploy preview action
Browse files Browse the repository at this point in the history
  • Loading branch information
limemloh committed Aug 10, 2023
1 parent d9c0cf3 commit d61888d
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 8 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy PR Preview
# Only run when a PR have the 'preview' label
on:
pull_request:
types:
- labeled

concurrency: preview-${{ github.ref }}

jobs:
build-and-deploy-preview:
if: github.event.label.name == 'preview'
runs-on: ubuntu-latest
container: sphinxdoc/sphinx
steps:
- name: Install git 🔧
shell: bash
run: |
apt-get update
apt-get install -y git
- name: Checkout 🛎️
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Install 🔧
shell: bash
run: |
apt-get install -y graphviz rsync
pip3 install -r requirements.txt
- name: Build 🛠
shell: bash
run: ./scripts/build.sh

- name: Deploy preview 🚀
uses: rossjrw/pr-preview-action@v1
with:
preview-branch: gh-pages
umbrella-dir: pr-preview
custom-url: developer.concordium.software
source-dir: ./build
action: deploy
3 changes: 3 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ jobs:
with:
branch: gh-pages
folder: build
# Prevent the default behavior of force pushing which will remove previews see https://github.com/marketplace/actions/deploy-pr-preview.
force: false
clean: true
clean-exclude: pr-preview/
19 changes: 19 additions & 0 deletions .github/workflows/remove-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Remove PR Preview

on:
pull_request:
types:
- closed # This hook is needed to remove the preview when PR is closed.

jobs:
remove-preview:
runs-on: ubuntu-latest
steps:
- name: Remove preview
uses: rossjrw/pr-preview-action@v1
with:
preview-branch: gh-pages
umbrella-dir: pr-preview
source-dir: ./build
action: remove

File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Tell crawlers to ignore PR preview builds.
User-agent: *
Disallow: /pr-preview/
10 changes: 2 additions & 8 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,8 @@ printf "Building documentation versions: ${all_versions} for languages ${all_lan

mkdir -p "${build_dir}"

printf "Copying index.html to ${build_dir}\n"
cp index.html "${build_dir}/index.html"

printf "Copying CLAs to ${build_dir}\n"
cp -r CLAs "${build_dir}/CLAs"

printf "Copying 'extra' directory to ${build_dir}\n"
cp -r extra "${build_dir}/extra"
printf "Copying 'public' to '${build_dir}'\n"
cp -rv public/* ${build_dir}

for current_version in ${versions[@]}; do
printf "\nVersion '${current_version}':\n-----------------------------\n"
Expand Down

0 comments on commit d61888d

Please sign in to comment.