diff --git a/.github/actions/publish-npm/action.yaml b/.github/actions/publish-npm/action.yaml new file mode 100644 index 000000000..925a95712 --- /dev/null +++ b/.github/actions/publish-npm/action.yaml @@ -0,0 +1,28 @@ +name: 'Publishes package to npm registry' + +inputs: + project-name: + description: 'Name of gradle project to test' + required: true + +runs: + using: 'composite' + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup antlr4 + uses: ./.github/actions/setup-antlr4 + + - name: Install dependencies with frozen lock file and generate parser + run: npm ci + + - name: Build project + run: npm run build + + - name: Publish on updated version number + uses: JS-DevTools/npm-publish@v2 + with: + token: ${{ secrets.NPM_TOKEN }} + package: 'packages/${{inputs.project-name}}/package.json' + access: 'public' diff --git a/.github/workflows/publish-cypher-codemirror.yaml b/.github/workflows/publish-cypher-codemirror.yaml deleted file mode 100644 index d87f07ba9..000000000 --- a/.github/workflows/publish-cypher-codemirror.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: Publish react-codemirror package to npm - -on: - # Runs on pushes targeting the default branch - # push: - # branches: ['main'] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -env: - NODE_OPTIONS: '--max_old_space_size=4096' - -jobs: - deploy: - environment: publish-npm - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Setup antlr4 - uses: ./.github/actions/setup-antlr4 - - - name: Install dependencies with frozen lock file and generate parser - run: npm ci - - - name: Build project - run: npm run build - - - name: Publish on updated version number - uses: JS-DevTools/npm-publish@v2 - with: - token: ${{ secrets.NPM_TOKEN }} - package: 'packages/react-codemirror/package.json' - access: 'restricted' diff --git a/.github/workflows/publish-packages.yaml b/.github/workflows/publish-packages.yaml new file mode 100644 index 000000000..7aa1dfd08 --- /dev/null +++ b/.github/workflows/publish-packages.yaml @@ -0,0 +1,27 @@ +name: Publish react-codemirror package to npm + +on: + # Runs on pushes targeting the default branch + # push: + # branches: ['main'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + NODE_OPTIONS: '--max_old_space_size=4096' + +jobs: + publish: + strategy: + fail-fast: false + matrix: + project: ['language-support', 'language-server', 'react-codemirror'] + + environment: publish-npm + runs-on: ubuntu-latest + steps: + - name: Publish ${{ matrix.project }} to npm + uses: ./.github/actions/publish-npm + with: + project-name: ${{ matrix.project }}