Repository navigation
Fixed paths #19
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: LDES Specification Build | |
| on: | |
| pull_request: | |
| paths: ["eventstreams.bs", "context.jsonld", "*.svg", "*.png", "*.jpg", "*.jpeg", "*.webp", "header.include", "footer.include", "logo.include", "assets/**"] | |
| push: | |
| branches: ["master"] | |
| tags: ["*"] | |
| paths: ["eventstreams.bs", "context.jsonld", "*.svg", "*.png", "*.jpg", "*.jpeg", "*.webp", "header.include", "footer.include", "logo.include", "assets/**", ".github/workflows/ldes-specification-build.yml"] | |
| workflow_dispatch: | |
| concurrency: | |
| group: gh-pages-publish | |
| cancel-in-progress: false | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "build" | |
| build: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| env: | |
| SEMICMATOMOID: ${{ secrets.SEMICMATOMOID }} | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v3 | |
| - name: Publish Bikeshed document | |
| if: ${{ env.SEMICMATOMOID == '' }} | |
| # You may pin to the exact commit or the version. | |
| uses: w3c/spec-prod@v2 | |
| with: | |
| TOOLCHAIN: bikeshed | |
| # Modify as appropriate | |
| GH_PAGES_BRANCH: gh-pages | |
| # The source file | |
| SOURCE: eventstreams.bs | |
| # output filename defaults to your input | |
| # with .html extension instead, | |
| # but if you want to customize it: | |
| DESTINATION: ${{ startsWith(github.ref, 'refs/tags/') && 'index.html' || 'workingdraft/index.html' }} | |
| - name: Publish Bikeshed document with Matomo | |
| if: ${{ env.SEMICMATOMOID != '' }} | |
| uses: w3c/spec-prod@v2 | |
| with: | |
| TOOLCHAIN: bikeshed | |
| GH_PAGES_BRANCH: gh-pages | |
| SOURCE: eventstreams.bs | |
| DESTINATION: ${{ startsWith(github.ref, 'refs/tags/') && 'index.html' || 'workingdraft/index.html' }} | |
| GH_PAGES_BUILD_OVERRIDE: | | |
| Text Macro: SEMICMATOMOID ${{ env.SEMICMATOMOID }} | |
| copy-working-draft-assets: | |
| name: Copy working draft assets | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout gh-pages | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: gh-pages | |
| fetch-depth: 0 | |
| - name: Checkout source snapshot | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.sha }} | |
| path: source-snapshot | |
| - name: Copy working draft assets | |
| run: | | |
| set -euo pipefail | |
| mkdir -p assets | |
| cp source-snapshot/assets/logo-ldes.svg assets/logo-ldes.svg | |
| mkdir -p workingdraft/assets | |
| cp source-snapshot/context.jsonld workingdraft/context.jsonld | |
| find source-snapshot -maxdepth 1 -type f \( -iname "*.svg" -o -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.webp" \) -exec cp {} workingdraft/ \; | |
| cp -R source-snapshot/assets/. workingdraft/assets/ | |
| rm -f workingdraft/assets/logo-ldes.svg | |
| rm -rf source-snapshot | |
| if git status --porcelain | grep . >/dev/null; then | |
| git config user.email "semic-eu+github-actions[bot]@users.noreply.github.com" | |
| git config user.name "SEMIC EU archival [bot]" | |
| git add assets/logo-ldes.svg workingdraft | |
| git commit -m "Update specification working draft assets" | |
| git push | |
| else | |
| echo "No changes to commit." | |
| fi | |
| copy-tag-version: | |
| name: Copy tag snapshot | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout gh-pages | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: gh-pages | |
| fetch-depth: 0 | |
| - name: Checkout source snapshot | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.ref }} | |
| path: source-snapshot | |
| - name: Copy spec snapshot | |
| run: | | |
| set -euo pipefail | |
| tag="${GITHUB_REF_NAME}" | |
| dest="releases/${tag}" | |
| mkdir -p "${dest}" | |
| cp index.html "${dest}/index.html" | |
| cp source-snapshot/context.jsonld "${dest}/context.jsonld" | |
| find source-snapshot -maxdepth 1 -type f \( -iname "*.svg" -o -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.webp" \) -exec cp {} "${dest}/" \; | |
| mkdir -p assets | |
| cp source-snapshot/assets/logo-ldes.svg assets/logo-ldes.svg | |
| mkdir -p "${dest}/assets" | |
| cp -R source-snapshot/assets/. "${dest}/assets/" | |
| rm -f "${dest}/assets/logo-ldes.svg" | |
| rm -f context.jsonld | |
| ln -s "${dest}/context.jsonld" context.jsonld | |
| rm -rf source-snapshot | |
| { | |
| cat <<EOF | |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Releases</title> | |
| <style> | |
| body { | |
| color: #1f1f1f; | |
| font-family: Arial, sans-serif; | |
| line-height: 1.5; | |
| margin: 0 auto; | |
| max-width: 48rem; | |
| padding: 3rem 1.5rem; | |
| } | |
| header { | |
| border-bottom: 1px solid #d9d9d9; | |
| margin-bottom: 2rem; | |
| padding-bottom: 1.5rem; | |
| text-align: center; | |
| } | |
| img { | |
| height: auto; | |
| max-width: 180px; | |
| } | |
| h1 { | |
| color: #005ea8; | |
| font-size: 2rem; | |
| font-weight: 600; | |
| margin: 1.5rem 0 0; | |
| } | |
| ul { | |
| list-style: none; | |
| padding: 0; | |
| } | |
| li { | |
| border-bottom: 1px solid #d9d9d9; | |
| } | |
| a { | |
| color: #005ea8; | |
| display: block; | |
| padding: 0.75rem 0; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <img src="https://semiceu.github.io/LinkedDataEventStreams/assets/logo-ldes.svg" alt="Linked Data Event Streams"> | |
| <h1>Releases</h1> | |
| </header> | |
| <main> | |
| <ul> | |
| EOF | |
| find releases -mindepth 1 -maxdepth 1 -type d ! -name assets -printf '%f\n' | sort -Vr | while read -r release; do | |
| printf ' <li><a href="%s/">%s</a></li>\n' "$release" "$release" | |
| done | |
| cat <<EOF | |
| </ul> | |
| </main> | |
| </body> | |
| </html> | |
| EOF | |
| } > releases/index.html | |
| cat > index.html <<EOF | |
| <!doctype html> | |
| <meta charset="utf-8"> | |
| <title>Redirecting to LDES ${tag}</title> | |
| <meta http-equiv="refresh" content="0; url=${dest}/index.html"> | |
| <link rel="canonical" href="${dest}/index.html"> | |
| <p>Latest release: <a href="${dest}/index.html">${dest}/index.html</a></p> | |
| EOF | |
| if git status --porcelain | grep . >/dev/null; then | |
| git config user.email "semic-eu+github-actions[bot]@users.noreply.github.com" | |
| git config user.name "SEMIC EU archival [bot]" | |
| git add index.html context.jsonld assets/logo-ldes.svg releases/index.html "${dest}" | |
| git commit -m "Add spec snapshot for ${tag}" | |
| git push | |
| else | |
| echo "No changes to commit." | |
| fi |