-
Notifications
You must be signed in to change notification settings - Fork 176
[WIP] Decouple examples gallery from the main repository #251
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b901f09
Pull sphinx-gallery from external repository
aperezhortal baedcdd
Update examples repository target branch
aperezhortal 88f9b50
Remove references to jupyter notebooks from comments
aperezhortal 2a27b3e
Update example gallery's URL in documentation
aperezhortal 3780450
Place the task to find the destination branch in a separate step
aperezhortal b6bd7c0
Add the event branch name to the triggering commit message
aperezhortal cfa5a7b
Allow the external_gallery to trigger the rendering action
aperezhortal 080d46a
Improve variables and task names
aperezhortal c4e4aef
Update commit message
aperezhortal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
.github/workflows/trigger_examples_rendering_in_external_repo.yml
This file contains hidden or 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,96 @@ | ||
######################################################################################## | ||
# Trigger the examples rendering in the external repository. | ||
# | ||
# This task push an empty commit to trigger the rendering of the example gallery | ||
# in an external repo as follows: | ||
# | ||
# ------------------------------------------ | ||
# | Local branch -> Example gallery branch | | ||
# | master -> main | | ||
# | other_branch -> dev | | ||
# ------------------------------------------ | ||
# | ||
# This workflow requires the EXAMPLES_GALLERY_TOKEN secret with the access token | ||
# for the repository containing the example gallery. | ||
######################################################################################## | ||
name: Trigger example rendering tasks in the external repository | ||
|
||
env: | ||
EXAMPLES_GALLERY_REPO: pysteps/pysteps-tutorials # External repository with the example gallery. | ||
THIS_REPO: pysteps/pysteps | ||
|
||
on: | ||
push: | ||
branches: [ master, dev, external_gallery] | ||
# pull_request: | ||
# branches: [ master, dev ] | ||
|
||
jobs: | ||
trigger_example_gallery_rendering: | ||
name: Trigger example rendering tasks in the external repository | ||
# The triggering is done by pushing an empty commit to the external repository | ||
# with the example gallery. The commit message contains the Hash of the | ||
# main repository's commit and the branch name that trigger the event. | ||
runs-on: "ubuntu-latest" | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- name: Get the name of the branch triggering this event | ||
id: get_triggering_branch | ||
run: | | ||
if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then | ||
event_branch=$(echo ${GITHUB_REF##*/}) | ||
elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then | ||
event_branch=$(echo $GITHUB_BASE_REF) | ||
else | ||
event_branch=unknown | ||
fi | ||
echo "::set-output name=event_branch::${event_branch}" | ||
|
||
- name: Set destination branch based on the triggering branch's name | ||
id: set_destination_branch | ||
run: | | ||
# We only push to latest or to dev. | ||
if [[ "${event_branch}" == "main" ]]; then | ||
echo "::set-output name=dest_branch::main" | ||
else | ||
echo "::set-output name=dest_branch::dev" | ||
fi | ||
|
||
- name: Print debug information | ||
env: | ||
DEST_BRANCH: ${{steps.set_destination_branch.outputs.dest_branch}} | ||
EVENT_BRANCH: ${{steps.get_triggering_branch.outputs.event_branch}} | ||
run: | | ||
echo "EVENT_BRANCH=${EVENT_BRANCH}" | ||
echo "GITHUB_SHA=${GITHUB_SHA}" | ||
echo "DEST_BRANCH=${DEST_BRANCH}" | ||
|
||
- name: Clone external repository with the example gallery. | ||
uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false # Avoid using the GITHUB_TOKEN instead of the personal access token | ||
fetch-depth: 0 # Avoid errors pushing refs to the destination repository. | ||
repository: ${{ env.EXAMPLES_GALLERY_REPO }} | ||
ref: ${{steps.set_destination_branch.outputs.dest_branch}} | ||
|
||
- name: Create empty commit in example gallery's repository | ||
env: | ||
EVENT_BRANCH: ${{steps.get_triggering_branch.outputs.event_branch}} | ||
run: | | ||
git config user.name 'github-actions[bot]' | ||
git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
git commit --allow-empty \ | ||
-m "[TRIGGER] Trigger rendering task from ${GITHUB_SHA::8}" \ | ||
-m "Branch:${EVENT_BRANCH}" \ | ||
-m "https://github.com/${THIS_REPO}/commit/${GITHUB_SHA}" | ||
|
||
- name: Push the empty commit to trigger the workflow | ||
uses: ad-m/github-push-action@master | ||
with: | ||
repository: ${{ env.EXAMPLES_GALLERY_REPO }} | ||
github_token: ${{ secrets.EXAMPLES_GALLERY_TOKEN }} | ||
branch: ${{steps.set_destination_branch.outputs.dest_branch}} |
This file contains hidden or 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 |
---|---|---|
|
@@ -85,3 +85,6 @@ venv.bak/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
/doc/source/user_guide/examples_gallery/ | ||
/doc/source/examples_gallery/ | ||
/examples/ |
This file contains hidden or 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 hidden or 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,3 +1,3 @@ | ||
_build/ | ||
generated | ||
auto_examples | ||
examples_gallery |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -6,4 +6,3 @@ sphinx_rtd_theme | |
sphinx_gallery | ||
scikit-image | ||
pandas | ||
|
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.