Repository navigation
Bump version to 0.4.0 #170
Workflow file for this run
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
| name: Draft PDF | |
| # Builds paper.md into a JOSS-formatted PDF (Pandoc + inara, via the official | |
| # openjournals action). Not a JOSS submission step -- this just keeps the | |
| # committed paper.pdf in the repo root in sync with paper.md/paper.bib for | |
| # local review. On a push to `dev` or `main` it commits the rebuilt PDF back. | |
| # Feature branches only build it (the PDF is uploaded as an artifact): a bot | |
| # commit at a PR's head leaves that PR's CI runs waiting for approval, and the | |
| # PDF is rebuilt on `dev` once the PR merges. Skipped for pull_request runs (a | |
| # PR checkout is a detached merge ref, not the head branch) and for tag pushes | |
| # (also detached, e.g. the v* tag a release creates), where pushing would go to | |
| # the wrong place or fail outright. | |
| on: | |
| push: | |
| paths: | |
| - paper.md | |
| - paper.bib | |
| - .github/workflows/draft-pdf.yml | |
| pull_request: | |
| paths: | |
| - paper.md | |
| - paper.bib | |
| - .github/workflows/draft-pdf.yml | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| paper: | |
| runs-on: ubuntu-latest | |
| name: Paper Draft | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build draft PDF | |
| uses: openjournals/openjournals-draft-action@master | |
| with: | |
| journal: joss | |
| paper-path: paper.md | |
| - name: Upload PDF artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: paper | |
| # The action writes the compiled PDF next to the paper source. | |
| path: paper.pdf | |
| - name: Commit and push rebuilt PDF | |
| if: github.event_name == 'push' && github.ref_type == 'branch' && (github.ref_name == 'dev' || github.ref_name == 'main') | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add paper.pdf | |
| if ! git diff --cached --quiet; then | |
| # No [skip ci] marker: it is per-commit, not per-event, so a squash | |
| # merge folds it into the merge commit message and silences every | |
| # workflow on the target branch (it swallowed an auto-bump-dev run | |
| # this way). Not needed anyway -- this pushes with the default | |
| # GITHUB_TOKEN, whose pushes do not trigger workflows. | |
| git commit -m "Rebuild paper.pdf" | |
| # Another workflow can push to the same branch while the PDF builds | |
| # (auto-bump-dev.yml bumps the version right after a merge to dev), | |
| # which rejects a plain push. Rebase onto the branch head and retry; | |
| # the bump never touches paper.pdf, so the rebase cannot conflict. | |
| for attempt in 1 2 3; do | |
| if git pull --rebase origin "$GITHUB_REF_NAME" && git push; then | |
| exit 0 | |
| fi | |
| sleep $((attempt * 5)) | |
| done | |
| echo "::error::could not push the rebuilt paper.pdf after 3 attempts" | |
| exit 1 | |
| else | |
| echo "paper.pdf unchanged, nothing to commit" | |
| fi |