diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab3ff8c694..3a490db8bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,49 +18,6 @@ env: PNPM_CACHE_FOLDER: .pnpm-store jobs: - # Update package versions with changesets. - version: - timeout-minutes: 8 - runs-on: ubuntu-latest - if: false == contains(github.ref, 'changeset') && github.repository == 'remirror/remirror' - steps: - - name: checkout code repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: setup caching - uses: actions/cache@v2 - with: - path: ${{ env.PNPM_CACHE_FOLDER }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: setup node.js - uses: actions/setup-node@v2-beta - with: - node-version: 14 - - - name: install and audit - uses: ./.github/actions/pnpm - with: - cache: ${{ env.PNPM_CACHE_FOLDER }} - - - name: check versions are valid - if: github.event.pull_request_target - run: pnpm version:check - - - name: create versions - uses: changesets/action@master - if: github.ref == 'refs/heads/next' - with: - version: pnpm version - commit: 'Update versions with changeset' - title: 'Update versions with changeset' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Lint the project lint: timeout-minutes: 8 @@ -332,45 +289,3 @@ jobs: - name: firefox integration test ${{ matrix.os }} run: cd support/e2e && pnpm firefox - - # Publish the public packages if all tests pass - publish: - timeout-minutes: 20 - needs: [lint, typecheck, unit_test, build_test, size_check, chromium_e2e, firefox_e2e] - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/next' && github.repository == 'remirror/remirror' - - steps: - - name: checkout code repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: setup caching - uses: actions/cache@v2 - with: - path: ${{ env.PNPM_CACHE_FOLDER }} - key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm- - - - name: setup node.js - uses: actions/setup-node@v2-beta - with: - node-version: 14 - - - name: install and audit - uses: ./.github/actions/pnpm - with: - cache: ${{ env.PNPM_CACHE_FOLDER }} - - - 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 }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..d77ee19b26 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,53 @@ +name: publish + +on: + workflow_run: + workflows: [ci] + branches: [next, main] + types: [completed] + +env: + PNPM_CACHE_FOLDER: .pnpm-store + +jobs: + # Publish the public to npm + npm: + if: github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/next' && github.repository == 'remirror/remirror' + timeout-minutes: 10 + needs: [lint, typecheck, unit_test, build_test, size_check, chromium_e2e, firefox_e2e] + runs-on: ubuntu-latest + + steps: + - name: checkout code repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: setup caching + uses: actions/cache@v2 + with: + path: ${{ env.PNPM_CACHE_FOLDER }} + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + + - name: setup node.js + uses: actions/setup-node@v2-beta + with: + node-version: 14 + + - name: install and audit + uses: ./.github/actions/pnpm + with: + cache: ${{ env.PNPM_CACHE_FOLDER }} + + - 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 }} diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000000..6898caedf8 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,59 @@ +name: version + +on: + push: + branches: + - main + - next + + pull_request: + branches: + - main + - next + +env: + PNPM_CACHE_FOLDER: .pnpm-store + +jobs: + # Update package versions with changesets. + version: + timeout-minutes: 8 + runs-on: ubuntu-latest + if: false == contains(github.ref, 'changeset') && github.repository == 'remirror/remirror' + steps: + - name: checkout code repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: setup caching + uses: actions/cache@v2 + with: + path: ${{ env.PNPM_CACHE_FOLDER }} + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + + - name: setup node.js + uses: actions/setup-node@v2-beta + with: + node-version: 14 + + - name: install and audit + uses: ./.github/actions/pnpm + with: + cache: ${{ env.PNPM_CACHE_FOLDER }} + + - name: check versions are valid + if: github.event.pull_request_target + run: pnpm version:check + + - name: create versions + uses: changesets/action@master + if: github.ref == 'refs/heads/next' + with: + version: pnpm version + commit: 'Update versions with changeset' + title: 'Update versions with changeset' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}