remirror/remirror

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
name: publish

on:
  workflow_run:
    workflows: [ci]
    branches: [main]
    types: [completed]

env:
  TURBO_TOKEN: ${{ secrets.VERCEL_STORYBOOK_TOKEN }}
  TURBO_TEAM: ${{ vars.TURBO_TEAM }}

concurrency: publish_workflow

jobs:
  # Publish the public packages to npm
  npm:
    if: github.event.workflow_run.conclusion == 'success'
    timeout-minutes: 50
    runs-on: ubuntu-latest

    steps:
      - name: checkout code repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: install and audit
        uses: ./support/actions/pnpm

      - name: build project
        run: pnpm build

      - name: publish npm release
        run: |
          echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > $HOME/.npmrc
          pnpm release
          rm $HOME/.npmrc
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

      - name: parse changelog for @remirror/react
        id: changelog_remirror_react
        uses: ocavue/changelog-parser-action@v1
        with:
          filePath: 'packages/remirror__react/CHANGELOG.md'

      - name: create release for @remirror/react
        uses: ncipollo/release-action@v1
        with:
          commit: main
          tag: '@remirror/react@${{ fromJSON(steps.changelog_remirror_react.outputs.parsed).versions[0].version }}'
          body: '${{ fromJSON(steps.changelog_remirror_react.outputs.parsed).versions[0].body }}'
          token: ${{ secrets.GITHUB_TOKEN }}
        continue-on-error: true

      - name: parse changelog for @remirror/pm
        id: changelog_remirror_pm
        uses: ocavue/changelog-parser-action@v1
        with:
          filePath: 'packages/remirror__pm/CHANGELOG.md'

      - name: create release for @remirror/pm
        uses: ncipollo/release-action@v1
        with:
          commit: main
          tag: '@remirror/pm@${{ fromJSON(steps.changelog_remirror_pm.outputs.parsed).versions[0].version }}'
          body: '${{ fromJSON(steps.changelog_remirror_pm.outputs.parsed).versions[0].body }}'
          token: ${{ secrets.GITHUB_TOKEN }}
        continue-on-error: true

      # make sure that `remirror` is the last one so that it can at the top of the release list
      - name: parse changelog for remirror
        id: changelog_remirror
        uses: ocavue/changelog-parser-action@v1
        with:
          filePath: 'packages/remirror/CHANGELOG.md'

      - name: create release for remirror
        uses: ncipollo/release-action@v1
        with:
          commit: main
          tag: 'remirror@${{ fromJSON(steps.changelog_remirror.outputs.parsed).versions[0].version }}'
          body: '${{ fromJSON(steps.changelog_remirror.outputs.parsed).versions[0].body }}'
          token: ${{ secrets.GITHUB_TOKEN }}
        continue-on-error: true