-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from wellcomecollection/rk/gha-build
Move build to GitHub Actions
- Loading branch information
Showing
18 changed files
with
107 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
steps: | ||
- command: .buildkite/scripts/convert_notebooks.sh | ||
if: build.branch != "main" | ||
label: "convert notebooks from .ipynb to .md" | ||
|
||
- command: .buildkite/scripts/build_html.sh | ||
if: build.branch != "main" | ||
label: "build HTML" | ||
|
||
- commands: | ||
- .buildkite/scripts/deploy_to_github.sh | ||
if: build.branch == "main" | ||
label: "deploy changes to GitHub" | ||
- command: true | ||
label: "Take no action" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: "Deploy to GitHub Pages" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build documentation | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Convert Notebooks | ||
run: scripts/convert_notebooks.sh | ||
- name: Commit update | ||
run: | | ||
git config --global user.name 'WeCo bot' | ||
git config --global user.email '[email protected]' | ||
git commit -am "Update notebooks" || exit 0 | ||
git push | ||
- name: Install Node | ||
# https://github.com/actions/setup-node?tab=readme-ov-file#usage | ||
# The node-version input is optional. If not supplied, the node version from PATH will be used. | ||
# However, it is recommended to always specify Node.js version and don't rely on the system one. | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Build website | ||
run: yarn build | ||
- name: Upload Build Artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: build | ||
|
||
|
||
deploy: | ||
name: Deploy to GitHub Pages | ||
needs: build | ||
|
||
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | ||
permissions: | ||
pages: write # to deploy to Pages | ||
id-token: write # to verify the deployment originates from an appropriate source | ||
|
||
# Deploy to the github-pages environment | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Test deployment" | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
name: Build documentation | ||
permissions: | ||
id-token: write | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- name: Convert Notebooks | ||
run: scripts/convert_notebooks.sh | ||
- name: Commit update | ||
run: | | ||
git config --global user.name 'WeCo bot' | ||
git config --global user.email '[email protected]' | ||
git commit -am "Update notebooks" || exit 0 | ||
git push | ||
- name: Install Node | ||
# https://github.com/actions/setup-node?tab=readme-ov-file#usage | ||
# The node-version input is optional. If not supplied, the node version from PATH will be used. | ||
# However, it is recommended to always specify Node.js version and don't rely on the system one. | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
- name: Build website | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ docker run --rm --tty \ | |
jupyter/scipy-notebook \ | ||
jupyter nbconvert \ | ||
--to markdown \ | ||
--template .buildkite/scripts/mdoutput \ | ||
--template "$root/scripts/mdoutput" \ | ||
--output-dir "$root/docs/examples" \ | ||
$root/notebooks/*.ipynb | ||
|
||
|
@@ -67,14 +67,13 @@ for file in $root/docs/examples/*.md; do | |
fi | ||
done | ||
|
||
|
||
# add a link to github and colab for each notebook | ||
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
for file in $root/notebooks/*.ipynb; do | ||
filename=$(basename -- "$file") | ||
|
||
github_path="wellcomecollection/developers.wellcomecollection.org/tree/$GIT_BRANCH/notebooks/$filename" | ||
github_path="wellcomecollection/developers.wellcomecollection.org/blob/$GIT_BRANCH/notebooks/$filename" | ||
github_url="https://github.com/$github_path" | ||
colab_url="https://colab.research.google.com/github/$github_path" | ||
|
||
|
@@ -83,22 +82,3 @@ for file in $root/notebooks/*.ipynb; do | |
# insert the line at the second line of the file | ||
awk -v line="$line" 'NR==2{print line}1' "$path" > tmp && mv -f tmp "$path" | ||
done | ||
|
||
# commit any changes back to the branch | ||
if [[ `git status --porcelain` ]]; then | ||
git config user.name "Buildkite on behalf of Wellcome Collection" | ||
git config user.email "[email protected]" | ||
|
||
git remote add ssh-origin $BUILDKITE_REPO || true | ||
git fetch ssh-origin | ||
git checkout --track ssh-origin/$BUILDKITE_BRANCH || true | ||
|
||
git add --verbose --update | ||
git commit -m "Convert notebooks" | ||
|
||
git push ssh-origin HEAD:$BUILDKITE_BRANCH | ||
exit 1; | ||
else | ||
echo "No changes from notebook conversion" | ||
exit 0; | ||
fi |
File renamed without changes.
File renamed without changes.