-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3b98e1
commit fc449c9
Showing
2 changed files
with
124 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# <!-- Managed automatically by PreTeXt authoring tools --> | ||
# (delete the above line to manage this file manually) | ||
|
||
name: PreTeXt-CLI Actions | ||
on: | ||
# Runs on pull requests | ||
pull_request: | ||
branches: ["*"] | ||
# Runs on pushes to main | ||
push: | ||
branches: ["main"] | ||
# Runs on demand | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: oscarlevin/pretext:full | ||
|
||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
|
||
- name: install deps | ||
run: pip install -r requirements.txt | ||
|
||
- name: build deploy targets | ||
run: pretext build --deploys | ||
- name: stage deployment | ||
run: pretext deploy --stage-only | ||
|
||
- name: Bundle output/stage as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: deploy | ||
path: output/stage | ||
|
||
deploy-cloudflare: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: vars.CLOUDFLARE_PROJECT_NAME != '' | ||
permissions: | ||
contents: read | ||
deployments: write | ||
|
||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: deploy | ||
path: deploy | ||
- name: Create 404.html | ||
run: echo "404 page not found" >> deploy/404.html | ||
- name: Publish to Cloudflare | ||
uses: cloudflare/pages-action@v1 | ||
with: | ||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }} | ||
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.head_ref || github.ref_name }} | ||
directory: deploy | ||
|
||
deploy-ghpages: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: vars.PTX_ENABLE_DEPLOY_GHPAGES == 'yes' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "page" | ||
cancel-in-progress: false | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Download website artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: deploy | ||
path: deploy | ||
- name: Setup GitHub Pages | ||
id: check | ||
uses: actions/configure-pages@v4 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: deploy | ||
- name: Deploy to Github Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
Oops, something went wrong.