diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 182194a5..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,46 +0,0 @@ -# This file was created automatically with `myst init --gh-pages` πŸͺ„ πŸ’š - -name: MyST GitHub Pages Deploy -on: - push: - # Runs on pushes targeting the default branch - branches: [main] -env: - # `BASE_URL` determines the website is served from, including CSS & JS assets - # You may need to change this to `BASE_URL: ''` - BASE_URL: /${{ github.event.repository.name }} - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: 'pages' - cancel-in-progress: false -jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup Pages - uses: actions/configure-pages@v3 - - uses: actions/setup-node@v4 - with: - node-version: 18.x - - name: Install MyST Markdown - run: npm install -g mystmd - - name: Build HTML Assets - run: myst build --html - - name: Upload artifact - uses: actions/upload-pages-artifact@v3.0.1 - with: - path: './_build/html' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/.github/workflows/nightly-build.yaml b/.github/workflows/nightly-build.yaml new file mode 100644 index 00000000..22c747e2 --- /dev/null +++ b/.github/workflows/nightly-build.yaml @@ -0,0 +1,22 @@ +name: nightly-build + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" # Daily β€œAt 00:00” + +jobs: + build: + if: ${{ github.repository_owner == 'ProjectPythia' }} + uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main + with: + build_command: 'myst build --execute --html' + + deploy: + needs: build + uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main + +# We don't have a link-checker with MyST right now +# link-check: +# if: ${{ github.repository_owner == 'ProjectPythia' }} +# uses: ProjectPythia/cookbook-actions/.github/workflows/link-checker.yaml@main \ No newline at end of file diff --git a/.github/workflows/publish-book.yaml b/.github/workflows/publish-book.yaml new file mode 100644 index 00000000..33f8f3df --- /dev/null +++ b/.github/workflows/publish-book.yaml @@ -0,0 +1,19 @@ +name: publish-book + +on: + # Trigger the workflow on push to main branch + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main + with: + build_command: 'myst build --execute --html' + + + deploy: + needs: build + uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main \ No newline at end of file diff --git a/.github/workflows/replace-links.yaml b/.github/workflows/replace-links.yaml new file mode 100644 index 00000000..1e208563 --- /dev/null +++ b/.github/workflows/replace-links.yaml @@ -0,0 +1,31 @@ +name: replace-links + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Find and Replace Repository Name + uses: jacobtomlinson/gha-find-replace@v3 + with: + find: "ProjectPythia/cookbook-template" + replace: "${{ github.repository_owner }}/${{ github.event.repository.name }}" + regex: false + exclude: ".github/workflows/replace-links.yaml" + + - name: Find and Replace Repository ID + uses: jacobtomlinson/gha-find-replace@v3 + with: + find: "475509405" + replace: "${{ github.repository_id}}" + regex: false + exclude: ".github/workflows/replace-links.yaml" + + - name: Push changes + uses: stefanzweifel/git-auto-commit-action@v5 \ No newline at end of file diff --git a/.github/workflows/trigger-book-build.yaml b/.github/workflows/trigger-book-build.yaml new file mode 100644 index 00000000..dca889af --- /dev/null +++ b/.github/workflows/trigger-book-build.yaml @@ -0,0 +1,12 @@ +name: trigger-book-build +on: + pull_request: + +jobs: + build: + uses: ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml@main + with: + build_command: 'myst build --execute --html' + artifact_name: book-zip-${{ github.event.number }} + base_url: '/${{ github.event.repository.name }}/_preview/${{ github.event.number }}' + # Other input options are possible, see ProjectPythia/cookbook-actions/.github/workflows/build-book.yaml \ No newline at end of file diff --git a/.github/workflows/trigger-delete-preview.yaml b/.github/workflows/trigger-delete-preview.yaml new file mode 100644 index 00000000..58f7124b --- /dev/null +++ b/.github/workflows/trigger-delete-preview.yaml @@ -0,0 +1,9 @@ +name: trigger-delete-preview + +on: + pull_request_target: + types: closed + +jobs: + delete: + uses: ProjectPythia/cookbook-actions/.github/workflows/delete-preview.yaml@main \ No newline at end of file diff --git a/.github/workflows/trigger-preview.yaml b/.github/workflows/trigger-preview.yaml new file mode 100644 index 00000000..10981fec --- /dev/null +++ b/.github/workflows/trigger-preview.yaml @@ -0,0 +1,27 @@ +name: trigger-preview +on: + workflow_run: + workflows: + - trigger-book-build + types: + - requested + - completed + +jobs: + find-pull-request: + uses: ProjectPythia/cookbook-actions/.github/workflows/find-pull-request.yaml@main + deploy-preview: + needs: find-pull-request + if: github.event.workflow_run.conclusion == 'success' + uses: ProjectPythia/cookbook-actions/.github/workflows/deploy-book.yaml@main + with: + artifact_name: book-zip-${{ needs.find-pull-request.outputs.number }} + destination_dir: _preview/${{ needs.find-pull-request.outputs.number }} # deploy to subdirectory labeled with PR number + is_preview: "true" + + preview-comment: + needs: find-pull-request + uses: ProjectPythia/cookbook-actions/.github/workflows/preview-comment.yaml@main + with: + pull_request_number: ${{ needs.find-pull-request.outputs.number }} + sha: ${{ needs.find-pull-request.outputs.sha }} \ No newline at end of file