Skip to content

Build Versioned Snapshot #2

Build Versioned Snapshot

Build Versioned Snapshot #2

name: Build Versioned Snapshot
on:
workflow_dispatch:
inputs:
version:
description: 'DataCite schema version (for example: 4.7)'
required: true
type: string
release_date:
description: 'Release date (YYYY-MM-DD). Leave blank to use today.'
required: false
type: string
commit_generated_files:
description: 'Commit generated outputs back to the selected branch.'
required: false
default: false
type: boolean
permissions:
contents: write
jobs:
build-snapshot:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Build snapshot
run: |
if [ -n "${{ inputs.release_date }}" ]; then
node scripts/release-snapshot.js --version "${{ inputs.version }}" --release-date "${{ inputs.release_date }}"
else
node scripts/release-snapshot.js --version "${{ inputs.version }}"
fi
- name: Commit generated outputs
if: ${{ inputs.commit_generated_files }}
env:
VERSION: ${{ inputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add \
index.html \
manifest/datacite-*.json \
manifest/release-matrix-*.json \
dist/datacite-*.jsonld \
dist/datacite-*.ttl \
dist/datacite-*.rdf \
class/index.html \
property/index.html \
vocab/index.html \
context/index.html \
dist/index.html \
manifest/index.html
if git diff --cached --quiet; then
echo "No generated changes to commit."
exit 0
fi
git commit -m "chore: update generated snapshot outputs for ${VERSION}"
git push origin HEAD:${GITHUB_REF_NAME}
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: datacite-snapshot-${{ inputs.version }}
path: |
index.html
manifest/datacite-*.json
manifest/release-matrix-*.json
dist/datacite-*.jsonld
dist/datacite-*.ttl
dist/datacite-*.rdf
class/index.html
property/index.html
vocab/index.html
context/index.html
dist/index.html
manifest/index.html