Skip to content

Commit

Permalink
Revert "chore: actions/cache -> actions-mn/cache actions-mn/build-and…
Browse files Browse the repository at this point in the history
…-publish#16"

This reverts commit 3e10779.
  • Loading branch information
strogonoff committed Jan 25, 2025
1 parent 40ae38a commit 2452fc4
Showing 1 changed file with 49 additions and 6 deletions.
55 changes: 49 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Auto-generated by Cimas: Do not edit it manually!
# See https://github.com/metanorma/cimas
# NOTE: I edited it manually — sorry
name: docker

on:
Expand Down Expand Up @@ -30,17 +33,57 @@ jobs:
- name: Print Metanorma version
run: metanorma --version

- name: Cache or generate Metanorma XML
# In case of cache miss, the generate MN XML step will run
# and the cache will be filled after job finishes.
# Next time it’ll be a cache hit, unless sources changed.
# See also “Upload cached Metanorma XML” step, which is important.
- name: Restore cached Metanorma XML, if any
id: cache-mn-xml
uses: actions/cache@v4
env:
cache-name: _site
with:
path: _site

# NOTE: cache key does not include current MN version,
# which means if sources did not change but it’s desirable
# to rebuild XML using a newer MN version it may be impossible to do
# without making a dummy/meaningless change in the content
# to change the hash.
#
# The proper way to address this could be pinning MN version
# somewhere and including it as part of the hash here;
# alternatively, if we really want to always use whatever MN version
# is latest, we could detect that version and include it
# as part of this key.
key: ${{ runner.os }}-mn-${{ env.cache-name }}-${{ hashFiles('sources/00*-v5/**', 'sources/xmi/**', 'sources/liquid_templates/**', 'sources/guidance/**') }}

# We can fuzzy-match latest available cache,
# instead of precise hash.
# This can speed up build in some scenarios,
# but can in theory also cause issues where XML is not updated
# after source changes.
# restore-keys: |
# ${{ runner.os }}-mn-${{ env.cache-name }}-
# ${{ runner.os }}-mn-
# ${{ runner.os }}-

- name: Generate Metanorma XML
uses: actions-mn/build-and-publish@v2
if: steps.cache-mn-xml.outputs.cache-hit != 'true'
with:
agree-to-terms: true
destination: artifact
artifact-name: mn
cache-site-for-manifest: metanorma.yml
cache-extra-input: |
sources/xmi/**
sources/liquid_templates/**
sources/guidance/**

# In case of cache hit, we must explicitly upload the _site dir as artifact
- name: Upload cached Metanorma XML
uses: actions/upload-artifact@v4
if: steps.cache-mn-xml.outputs.cache-hit == 'true'
with:
name: mn
path: _site
if-no-files-found: error

fl-build:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 2452fc4

Please sign in to comment.