Make transferProps
available to users (#524)
#260
This file contains 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: Release Management | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
test_and_build: | |
name: Test and build | |
runs-on: ubuntu-20.04 | |
outputs: | |
version_changed: ${{ steps.check_package_version.outputs.changed }} | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install | |
run: npm ci | |
- name: Lint | |
run: npm run lint | |
- name: Test | |
run: npm test | |
- name: Build | |
run: npm run build | |
- name: Check package.json for version change | |
id: check_package_version | |
uses: EndBug/version-check@v2 | |
- name: Log when version changed | |
if: steps.check_package_version.outputs.changed == 'true' | |
run: 'echo "Version change found in commit ${{ steps.check_package_version.outputs.commit }}! New version: ${{ steps.check_package_version.outputs.version }} (${{ steps.check_package_version.outputs.type }})"' | |
- name: Log when version unchanged | |
if: steps.check_package_version.outputs.changed == 'false' | |
run: 'echo "No version change"' | |
update_release_draft: | |
name: Update release draft | |
permissions: | |
contents: write | |
needs: [test_and_build] | |
if: needs.test_and_build.outputs.version_changed == 'false' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Draft release on GitHub | |
uses: release-drafter/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish_release_draft_on_version_bump: | |
name: Publish release draft | |
needs: [test_and_build] | |
if: needs.test_and_build.outputs.version_changed == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
# An existing release draft is published only if there is a version bump in `package.json`. | |
# Throws an error and breaks the job if called regardless. We check for version changes in the | |
# `test_and_build` job first so this job is skipped rather than exited with an error. | |
- name: Publish matching GitHub release draft | |
id: github_release | |
uses: JamesMGreene/node-draft-releaser@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
allow_release_name_update: 'false' | |
- name: Write out the release URL | |
run: echo "Released at $RELEASE_URL" | |
env: | |
RELEASE_URL: ${{ steps.github_release.outputs.release_url }} | |
publish_package_to_npm: | |
name: Publish to npm | |
needs: [test_and_build, publish_release_draft_on_version_bump] | |
if: needs.test_and_build.outputs.version_changed == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
registry-url: https://registry.npmjs.org | |
- name: Install | |
run: npm ci | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}} | |
deploy_docs: | |
name: Deploy docs | |
permissions: | |
contents: write | |
needs: [test_and_build, publish_release_draft_on_version_bump] | |
if: needs.test_and_build.outputs.version_changed == 'true' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- name: Get cache ID | |
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- name: Restore cache | |
uses: actions/cache@v4 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- name: Install MkDocs | |
run: pip install 'mkdocs-material>=9.0.0,<10.0.0' | |
- name: Build MkDocs | |
run: mkdocs gh-deploy --force |