-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc4dc5f
commit f7570c1
Showing
1 changed file
with
19 additions
and
47 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,59 +1,31 @@ | ||
name: Build Binder Image | ||
name: Pre-Build Binder Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
paths: | ||
- environment.yml | ||
- notebooks/**/*.ipynb | ||
- exploratory_tools/**/*.ipynb | ||
- tutorials/**/*.ipynb | ||
pull_request: | ||
paths: | ||
- environment.yml | ||
- notebooks/**/*.ipynb | ||
- exploratory_tools/**/*.ipynb | ||
- tutorials/**/*.ipynb | ||
- '**/*' | ||
|
||
jobs: | ||
build: | ||
prebuild-binder: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
- name: Cache Binder Build on MyBinder.org | ||
uses: jupyterhub/repo2docker-action@master | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: pip install jupyter-repo2docker nbformat pyyaml | ||
|
||
- name: Build and Tag Binder image | ||
run: | | ||
TAG="mybinder.org-image:latest" | ||
jupyter-repo2docker \ | ||
--no-run \ | ||
--image-name=$TAG . | ||
- name: Verify Tagged Binder Image | ||
run: | | ||
TAG="mybinder.org-image:latest" | ||
if docker inspect $TAG; then | ||
echo "Binder image with tag '$TAG' built successfully" | ||
else | ||
echo "Binder image build failed" | ||
exit 1 | ||
fi | ||
ref: ${{ github.sha }} | ||
binder-url: https://mybinder.org | ||
no-push: true | ||
|
||
- name: Add Binder badge | ||
- name: Generate Binder Link for Commit | ||
run: | | ||
REPO_URL=$(git config --get remote.origin.url) | ||
BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
BADGE_URL="https://mybinder.org/v2/gh/${REPO_URL#https://github.com/}/${BRANCH}" | ||
echo "Binder Badge: [](${BADGE_URL})" | ||
echo "Visit your Binder environment here: ${BADGE_URL}" | ||
- name: Check imported packages in notebooks | ||
run: python check_imports.py | ||
REPO_URL=$(git config --get remote.origin.url | sed 's/https:\/\/github.com\///') | ||
COMMIT_HASH=${GITHUB_SHA} | ||
echo "Your Binder link for this commit is:" | ||
echo "https://mybinder.org/v2/gh/$REPO_URL/$COMMIT_HASH" |