fix #11
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
name: Repo2docker | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
APP_ID: '189113' # https://github.com/apps/wen-wei-s-pr-bot | |
jobs: | |
binder: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Julia | |
uses: julia-actions/setup-julia@v2 | |
- name: Convert literate notebooks to ipynb files | |
shell: julia --color=yes {0} | |
working-directory: docs | |
run: | | |
import Pkg | |
Pkg.add("Literate") | |
using Literate | |
for (root, dirs, files) in walkdir(pwd()) | |
for file in files | |
if endswith(file, ".jl") | |
nb = joinpath(root, file) | |
Literate.notebook(nb, dirname(nb); mdstrings=true, execute=false) | |
end | |
end | |
end | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- name: Remove binder cache file | |
run: | | |
rm binder/Dockerfile || true | |
rm -r binder || true | |
- name: Update binder docker image with repo2docker | |
uses: jupyterhub/repo2docker-action@master | |
with: | |
DOCKER_REGISTRY: ghcr.io | |
DOCKER_USERNAME: ${{ github.repository_owner }} | |
DOCKER_PASSWORD: ${{ github.token }} | |
IMAGE_NAME: ${{ github.repository }} | |
PUBLIC_REGISTRY_CHECK: true | |
LATEST_TAG_OFF: true | |
ADDITIONAL_TAG: binder | |
- name: Write binder cache file | |
run: | | |
mkdir -p binder | |
echo "FROM ghcr.io/${{ github.repository }}:binder" > binder/Dockerfile | |
# Authenticate with a custom GitHub APP | |
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens | |
- name: Generate token for PR | |
uses: actions/create-github-app-token@v1 | |
id: generate-token | |
with: | |
app-id: ${{ env.APP_ID }} | |
private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
title: Add binder docker image path | |
token: ${{ steps.generate-token.outputs.token }} | |
labels: | | |
automerge |