From 1b85827d90e695de3256c8cf4e1f3a01b4fda5dc Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Wed, 24 Jan 2024 14:01:00 -0800 Subject: [PATCH] Meta: publish biblio in github actions --- .github/workflows/publish-biblio.yml | 32 ++++++++++++++++++++++++++++ LICENSE.md | 4 ++++ biblio/README.md | 9 ++++++++ biblio/package.json | 19 +++++++++++++++++ scripts/publish-biblio.sh | 22 +++++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 .github/workflows/publish-biblio.yml create mode 100644 LICENSE.md create mode 100644 biblio/README.md create mode 100644 biblio/package.json create mode 100755 scripts/publish-biblio.sh diff --git a/.github/workflows/publish-biblio.yml b/.github/workflows/publish-biblio.yml new file mode 100644 index 00000000..94a46106 --- /dev/null +++ b/.github/workflows/publish-biblio.yml @@ -0,0 +1,32 @@ +name: 'ecma-402-biblio' + +on: + push: + branches: + - main + +jobs: + publish: + name: 'publish ecma402-biblio' + runs-on: ubuntu-latest + if: ${{ github.repository == 'tc39/ecma402' }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 'lts/*' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Publish biblio + run: scripts/publish-biblio.sh + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_FOR_TC39_USER }} diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..69359e71 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,4 @@ +This repository is licensed according to Ecma International TC39's [Intellectual Property Policy](https://github.com/tc39/how-we-work/blob/HEAD/ip.md). In particular: +- Natural language text is licensed under the "Alternative copyright notice" of the [Ecma text copyright policy](https://www.ecma-international.org/memento/Ecma%20copyright%20faq.htm). +- Source code is licensed under Ecma's MIT-style [Ecma International Policy on Submission, Inclusion and Licensing of Software](https://www.ecma-international.org/memento/Policies/Ecma_Policy_on_Submission_Inclusion_and_Licensing_of_Software.htm). +- Contributions are only accepted from either representatives of Ecma members or signatories of TC39's [Contributor Form](https://tc39.github.io/agreements/contributor/). diff --git a/biblio/README.md b/biblio/README.md new file mode 100644 index 00000000..3e8d0aeb --- /dev/null +++ b/biblio/README.md @@ -0,0 +1,9 @@ +# ECMA-402 Bibliography + +This package, available on npm as `@tc39/ecma402-biblio`, contains a machine-readable representation of the terms, clauses, grammar, and abstract operations defined in ECMA-402. This will primarily be of use to people working with the specification itself. + +If added as a dependency to a project using ecmarkup, you can load it by passing `--load-biblio @tc39/ecma402-biblio`. + +It is automatically updated whenever ECMA-402 is. It is inherently unstable: editorial changes to the specification may add, remove, or modify the biblio, which may break your build (for example, if using ecmarkup with `--lint-spec --strict`). As such, **the usual semver guarantees do not hold**. You should pin a precise version of this package. + +Major version bumps may be used for breaking changes to the format of the biblio itself. Minor version bumps may be used for non-breaking additions to the biblio format. diff --git a/biblio/package.json b/biblio/package.json new file mode 100644 index 00000000..2bb6b0b8 --- /dev/null +++ b/biblio/package.json @@ -0,0 +1,19 @@ +{ + "name": "@tc39/ecma402-biblio", + "version": "VERSIONED-DURING-PUBLISH", + "commit": "POPULATED-DURING-PUBLISH", + "description": "Machine-readable representation of the internals of the ecma-402 spec", + "keywords": [ + "ecmascript" + ], + "author": "TC39", + "main": "biblio.json", + "exports": { + ".": "./biblio.json", + "./package.json": "./package.json" + }, + "files": [ + "biblio.json" + ], + "license": "SEE LICENSE IN LICENSE.md" +} diff --git a/scripts/publish-biblio.sh b/scripts/publish-biblio.sh new file mode 100755 index 00000000..63cec199 --- /dev/null +++ b/scripts/publish-biblio.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -euxo pipefail + + +npx ecmarkup --verbose spec.html --write-biblio biblio/biblio.json /dev/null + +cp LICENSE.md biblio/ + +cd biblio + +COMMIT_COUNT=$(git rev-list --count HEAD) +npm version --no-git-tag-version "2.1.${COMMIT_COUNT}" + +SHORT_COMMIT=$(git rev-parse --short HEAD) +LONG_COMMIT=$(git rev-parse --verify HEAD) +echo " +This version was built from commit [${SHORT_COMMIT}](https://github.com/tc39/ecma402/tree/${LONG_COMMIT})." >> README.md + +npm pkg set commit="${LONG_COMMIT}" + +npm publish --access public