Skip to content

Commit e10d009

Browse files
authored
document caching (#119)
* document caching * fix actions yaml * ensure key is unique but also partially matched always * shorten restore key
1 parent f422b9c commit e10d009

File tree

3 files changed

+48
-37
lines changed

3 files changed

+48
-37
lines changed

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ jobs:
126126
*.lof
127127
*.lot
128128
*.toc
129-
key: latex
129+
key: latex-${{ github.run_id }}
130+
restore-keys: latex
130131

131132
- name: Render for release
132133
uses: trustedcomputinggroup/markdown@latest

.github/workflows/render-samples.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ jobs:
6868
*.lof
6969
*.lot
7070
*.toc
71-
key: latex
71+
key: latex-${{ github.run_id }}
72+
restore-keys: latex
7273

7374
- name: Run the action on guide
7475
uses: trustedcomputinggroup/markdown@latest

guide.md

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,23 @@ Even if you used the template repository, please double-check this. As the tools
101101
are being actively developed, there is probably a newer version of the tools
102102
available for you!
103103

104-
::: Caveat :::
104+
:::::::::::::::::::::::::::::::::::: Note :::::::::::::::::::::::::::::::::::::
105105
Use `ghcr.io/trustedcomputinggroup/pandoc:latest` at your own risk. As the tools
106106
may change defaults from version to version, it is better to pin your doc to
107107
a particular version of the tools and periodically update the tools as needed.
108-
::::::::::::::
108+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
109109

110-
A typical Markdown-in-GitHub spec might want to automate the following:
110+
A typical GitHub Markdown repo will:
111111

112-
* Render the spec to PDF on every pull request so that reviewers can check it.
113-
* Render the spec to PDF and Word on every release and attach to the release
114-
page.
112+
* Render the spec to PDF on pull requests and attach the PDF to the PR.
113+
* Render the spec to PDF and Word on releases and attach them to the release.
114+
* Cache the LaTex intermediate files to the GitHub actions cache. This allows
115+
small changes to the doc to render faster.
115116

116117
`.github/workflows/actions.yml` might look a bit like this:
117118

118119
```yaml
119-
# Render the spec to PDF and Word on pull requests and releases, attaching the
120-
# outputs to the pull request / release, as appropriate.
121-
122120
name: Render spec
123-
124121
on:
125122
pull_request:
126123
release:
@@ -130,11 +127,28 @@ jobs:
130127
render:
131128
runs-on: ubuntu-latest
132129
container:
133-
image: ghcr.io/trustedcomputinggroup/pandoc:0.8.2
134-
name: Render PDF
130+
image: ghcr.io/trustedcomputinggroup/pandoc:0.9.10
131+
name: Render PDF and Word
135132
steps:
136133
- name: Checkout
137134
uses: actions/checkout@v3
135+
with:
136+
fetch-depth: 0
137+
fetch-tags: true
138+
139+
- name: Cache LaTeX files
140+
uses: actions/cache@v3
141+
env:
142+
cache-name: cache-latex-files
143+
with:
144+
path: |
145+
*.aux
146+
*.fdb_latexmk
147+
*.lof
148+
*.lot
149+
*.toc
150+
key: latex-${{ github.run_id }}
151+
restore-keys: latex
138152

139153
- name: Render
140154
uses: trustedcomputinggroup/[email protected]
@@ -150,13 +164,6 @@ jobs:
150164
name: spec.pdf
151165
path: spec.pdf
152166

153-
- name: Upload Word to PR
154-
uses: actions/upload-artifact@master
155-
if: ${{ github.event_name == 'pull_request' }}
156-
with:
157-
name: spec.docx
158-
path: spec.docx
159-
160167
- name: Upload PDF and docx to release
161168
uses: svenstaro/upload-release-action@v2
162169
if: ${{ github.event_name == 'release' }}
@@ -347,11 +354,11 @@ If you have GitHub Actions for rendering the spec for releases (see
347354
5. A few minutes later, the PDF and DOCX of the spec will appear on the page
348355
for that release (you can monitor this on the "Actions" page).
349356

350-
::: Tip :::
357+
:::::::::::::::::::::::::::::::::::: Note :::::::::::::::::::::::::::::::::::::
351358
When balloting or sending a document to the TC for review, please create a docx
352359
diff from Microsoft Word, comparing the docx outputs attached between releases
353360
with Word's "Compare Versions" tool.
354-
:::::::::::
361+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
355362

356363
# Using Markdown
357364

@@ -475,7 +482,7 @@ TCG uses a special visual style to demarcate informative non-binding remarks wit
475482
To create an informative note, use the following syntax:
476483

477484
```md
478-
::: Informative :::
485+
::::::::::::::::::::::::::::::::: Informative :::::::::::::::::::::::::::::::::
479486
This is the only informative text block in this document.
480487

481488
These blocks can contain multiple paragraphs.
@@ -488,40 +495,42 @@ too large in an Informative Text block.
488495
| SPECIFICATION | Usually |
489496
| GUIDANCE | Rarely |
490497
| REFERENCE | Rarely |
491-
:::::::::::::::::::
498+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
492499
```
493500

494501
The above Markdown code becomes:
495502

496-
::: Informative :::
503+
::::::::::::::::::::::::::::::::: Informative :::::::::::::::::::::::::::::::::
497504
This is the only informative text block in this document.
498505

499-
These blocks can contain multiple paragraphs, tied together by lines containing just
500-
">".
506+
These blocks can contain multiple paragraphs, bulleted lists, etc.
501507

502-
These blocks can even contain tables! However, be wary of providing tables that are
503-
too large in an Informative Text block.
508+
These blocks can even contain tables!
504509

505510
| Document Type | Informative Blocks |
506511
| ----------------- | ---------------------- |
507512
| SPECIFICATION | Usually |
508513
| GUIDANCE | Rarely |
509514
| REFERENCE | Rarely |
510-
:::::::::::::::::::
515+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
516+
517+
Strictly speaking, three colons (`:::`) are the minimum required for marking
518+
an informative text block. However, it may make the plaintext version of the
519+
doc easier to read.
511520

512521
### Other Informative Blocks
513522

514523
Writers of a document may prefer "informative" blocks with more specific
515524
semantics. In this case, the text is still contained within a "TCG Informative"
516525
gray box, but with a more meaningful header.
517526

518-
::: Note :::
527+
:::::::::::::::::::::::::::::::::::: Note :::::::::::::::::::::::::::::::::::::
519528
This is a "Note" block.
520-
::::::::::::
529+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
521530

522-
::: Example :::
531+
:::::::::::::::::::::::::::::::::: Example ::::::::::::::::::::::::::::::::::::
523532
This is an "Example" block.
524-
:::::::::::::::
533+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
525534

526535
The behavior of blocks with labels not specified above may change meaningfully in future versions of this toolkit, so use them at your own risk.
527536

@@ -995,10 +1004,10 @@ documents in Markdown:
9951004
of a "Final" styled document. Note that according to the rules of semver, 1.23.5 is higher
9961005
than 1.23.5-rc.1.
9971006

998-
::: Note :::
1007+
:::::::::::::::::::::::::::::::::::: Note :::::::::::::::::::::::::::::::::::::
9991008
If the spec is not rendered as part of a release, it will always be
10001009
a draft, of some revision on top of the latest released version.
1001-
::::::::::::
1010+
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
10021011

10031012
### Suppressing Git Version Parsing
10041013

0 commit comments

Comments
 (0)