diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..e4f4e536 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,40 @@ +name: Release packages +on: + release: + types: [published] +concurrency: ${{ github.workflow }}-${{ github.ref }} +jobs: + # Releases to npm after bumping the package.json version from 0.0.0 to $TAG.0 as the tags only contain MAJOR.MINOR + npm: + name: Publish to npm + runs-on: ubuntu-latest + if: github.event.release.prerelease == false + defaults: + run: + working-directory: packages/npm + steps: + - name: 🧮 Checkout code + uses: actions/checkout@v3 + + - name: 🔧 Yarn cache + uses: actions/setup-node@v3 + with: + cache: "yarn" + registry-url: "https://registry.npmjs.org" + + - name: 🔨 Install dependencies + run: "yarn install --frozen-lockfile" + + - name: 🎖 Bump package.json version + run: "yarn version $VERSION" + env: + VERSION: ${{ github.event.release.tag_name }}.0 + + - name: 🚀 Publish to npm + id: npm-publish + uses: JS-DevTools/npm-publish@5a85faf05d2ade2d5b6682bfe5359915d5159c6c # v2.2.1 + with: + token: ${{ secrets.NPM_TOKEN }} + package: packages/npm + access: public + ignore-scripts: false diff --git a/README.md b/README.md index 1482fcdd..26d8f5c2 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Additionally, the following directories may be of interest: * `/data-definitions`: Bits of structured data consumable by Matrix implementations. * `/meta`: Documentation relating to the spec's processes that are otherwise untracked (release instructions, etc). * `/scripts`: Various scripts for generating the spec and validating its contents. +* `/packages`: Various packages for shipping spec files like OpenAPI/swagger bindings and data definitions. ## Authoring changes to the spec diff --git a/changelogs/internal/newsfragments/1620.feature b/changelogs/internal/newsfragments/1620.feature new file mode 100644 index 00000000..76f7eee7 --- /dev/null +++ b/changelogs/internal/newsfragments/1620.feature @@ -0,0 +1 @@ +Create @matrix-org/spec npm package to ship the SAS Emoji data definitions & translations. diff --git a/packages/npm/.gitignore b/packages/npm/.gitignore new file mode 100644 index 00000000..133fcabd --- /dev/null +++ b/packages/npm/.gitignore @@ -0,0 +1,2 @@ +node_modules +sas-emoji.json diff --git a/packages/npm/package.json b/packages/npm/package.json new file mode 100644 index 00000000..d305fda9 --- /dev/null +++ b/packages/npm/package.json @@ -0,0 +1,13 @@ +{ + "name": "@matrix-org/spec", + "version": "0.0.0", + "description": "Data definitions for the Matrix Spec", + "author": "matrix.org", + "license": "Apache-2.0", + "files": [ + "sas-emoji.json" + ], + "scripts": { + "prepare": "cp ../../data-definitions/sas-emoji.json ." + } +} diff --git a/packages/npm/yarn.lock b/packages/npm/yarn.lock new file mode 100644 index 00000000..fb57ccd1 --- /dev/null +++ b/packages/npm/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + +