-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (50 loc) · 1.51 KB
/
binder-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Build Binder Image
on:
push:
paths:
- environment.yml
- notebooks/**/*.ipynb
- exploratory_tools/**/*.ipynb
- tutorials/**/*.ipynb
pull_request:
paths:
- environment.yml
- notebooks/**/*.ipynb
- exploratory_tools/**/*.ipynb
- tutorials/**/*.ipynb
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
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
- name: Add Binder badge
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: [![Binder](${BADGE_URL}/badge.svg)](${BADGE_URL})"
echo "Visit your Binder environment here: ${BADGE_URL}"
- name: Check imported packages in notebooks
run: python check_imports.py