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

Automatically change Pages and Registry URL in gh-pages branch #101

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,35 @@ jobs:
- name: Create conda environment
run: conda create --quiet -c conda-forge --name shpc spython

- name: Check out main
uses: "actions/checkout@v3"
with:
ref: "main"
path: "tmp-registry"

- name: Install shpc
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate shpc
pip install git+https://github.com/singularityhub/singularity-hpc@main
git clone https://github.com/singularityhub/shpc-registry /tmp/registry

- name: Set Pages base URL and Registry URL
run: |
URL=$(curl -L \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is some risk here of running this regularly (and having the API response not return successfully, etc.) I want to suggest we add this instruction to the tutorial, to be done once, and it's OK if it's automated like this, or just a manual instruction.

-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/pages \
| jq -r '.html_url')
sed -i "s|/shpc-registry|$URL|" _config.yml
sed -i "s|singularityhub/shpc-registry|${{ github.repository }}|" generate.sh

- name: Generate docs
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate shpc
/bin/bash generate.sh /tmp/registry
/bin/bash generate.sh ./tmp-registry
rm -r tmp-registry

- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.1
Expand Down