Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deploy preview action (2) #862

Merged
merged 4 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
limemloh marked this conversation as resolved.
Show resolved Hide resolved
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/
24 changes: 24 additions & 0 deletions .github/workflows/remove-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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: Checkout 🛎️
uses: actions/[email protected]
with:
fetch-depth: 0

- 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.
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}
abizjak marked this conversation as resolved.
Show resolved Hide resolved

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