Skip to content

Commit ddd6fa4

Browse files
bakkotryzokuken
authored andcommitted
Meta: publish biblio in github actions
1 parent 75252a3 commit ddd6fa4

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

.github/workflows/publish-biblio.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'ecma-402-biblio'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
name: 'publish ecma402-biblio'
11+
runs-on: ubuntu-latest
12+
if: ${{ github.repository == 'tc39/ecma402' }}
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup node
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: 'lts/*'
24+
registry-url: 'https://registry.npmjs.org'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Publish biblio
30+
run: scripts/publish-biblio.sh
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_FOR_TC39_USER }}

biblio/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ECMA-402 Bibliography
2+
3+
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.
4+
5+
If added as a dependency to a project using ecmarkup, you can load it by passing `--load-biblio @tc39/ecma402-biblio`.
6+
7+
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.
8+
9+
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.

biblio/package.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@tc39/ecma402-biblio",
3+
"version": "VERSIONED-DURING-PUBLISH",
4+
"commit": "POPULATED-DURING-PUBLISH",
5+
"description": "Machine-readable representation of the internals of the ecma-402 spec",
6+
"keywords": [
7+
"ecmascript"
8+
],
9+
"author": "TC39",
10+
"main": "biblio.json",
11+
"exports": {
12+
".": "./biblio.json",
13+
"./package.json": "./package.json"
14+
},
15+
"files": [
16+
"biblio.json"
17+
],
18+
"license": "SEE LICENSE IN LICENSE.md"
19+
}

scripts/publish-biblio.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
6+
npx ecmarkup --verbose spec.html --write-biblio biblio/biblio.json /dev/null
7+
8+
cp LICENSE.md biblio/
9+
10+
cd biblio
11+
12+
COMMIT_COUNT=$(git rev-list --count HEAD)
13+
npm version --no-git-tag-version "2.1.${COMMIT_COUNT}"
14+
15+
SHORT_COMMIT=$(git rev-parse --short HEAD)
16+
LONG_COMMIT=$(git rev-parse --verify HEAD)
17+
echo "
18+
This version was built from commit [${SHORT_COMMIT}](https://github.com/tc39/ecma402/tree/${LONG_COMMIT})." >> README.md
19+
20+
npm pkg set commit="${LONG_COMMIT}"
21+
22+
npm publish --access public

0 commit comments

Comments
 (0)