Skip to content

Commit c37bfab

Browse files
authored
Merge pull request #94 from brian-rose/update-workflows
2 parents c137dbb + 5704ccb commit c37bfab

File tree

7 files changed

+120
-46
lines changed

7 files changed

+120
-46
lines changed

.github/workflows/deploy.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: nightly-build
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *" # Daily “At 00:00”
7+
8+
jobs:
9+
build:
10+
if: ${{ github.repository_owner == 'ProjectPythia' }}
11+
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
12+
with:
13+
build_command: 'myst build --execute --html'
14+
15+
deploy:
16+
needs: build
17+
uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main
18+
19+
# We don't have a link-checker with MyST right now
20+
# link-check:
21+
# if: ${{ github.repository_owner == 'ProjectPythia' }}
22+
# uses: ProjectPythia/cookbook-actions/.github/workflows/link-checker.yaml@main
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: publish-book
2+
3+
on:
4+
# Trigger the workflow on push to main branch
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
13+
with:
14+
build_command: 'myst build --execute --html'
15+
16+
17+
deploy:
18+
needs: build
19+
uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: replace-links
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Find and Replace Repository Name
15+
uses: jacobtomlinson/gha-find-replace@v3
16+
with:
17+
find: "ProjectPythia/cookbook-template"
18+
replace: "${{ github.repository_owner }}/${{ github.event.repository.name }}"
19+
regex: false
20+
exclude: ".github/workflows/replace-links.yaml"
21+
22+
- name: Find and Replace Repository ID
23+
uses: jacobtomlinson/gha-find-replace@v3
24+
with:
25+
find: "475509405"
26+
replace: "${{ github.repository_id}}"
27+
regex: false
28+
exclude: ".github/workflows/replace-links.yaml"
29+
30+
- name: Push changes
31+
uses: stefanzweifel/git-auto-commit-action@v5
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: trigger-book-build
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
build:
7+
uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main
8+
with:
9+
build_command: 'myst build --execute --html'
10+
artifact_name: book-zip-${{ github.event.number }}
11+
base_url: '/${{ github.event.repository.name }}/_preview/${{ github.event.number }}'
12+
# Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: trigger-delete-preview
2+
3+
on:
4+
pull_request_target:
5+
types: closed
6+
7+
jobs:
8+
delete:
9+
uses: ProjectPythia/cookbook-actions/.github/workflows/delete-preview.yaml@main
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: trigger-preview
2+
on:
3+
workflow_run:
4+
workflows:
5+
- trigger-book-build
6+
types:
7+
- requested
8+
- completed
9+
10+
jobs:
11+
find-pull-request:
12+
uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main
13+
deploy-preview:
14+
needs: find-pull-request
15+
if: github.event.workflow_run.conclusion == 'success'
16+
uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main
17+
with:
18+
artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }}
19+
destination_dir: _preview/${{ needs.find-pull-request.outputs.number }} # deploy to subdirectory labeled with PR number
20+
is_preview: "true"
21+
22+
preview-comment:
23+
needs: find-pull-request
24+
uses: ProjectPythia/cookbook-actions/.github/workflows/preview-comment.yaml@main
25+
with:
26+
pull_request_number: ${{ needs.find-pull-request.outputs.number }}
27+
sha: ${{ needs.find-pull-request.outputs.sha }}

0 commit comments

Comments
 (0)