Skip to content

Commit

Permalink
Seperate version and publish CI actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed Oct 10, 2020
1 parent de6a430 commit 6005735
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 85 deletions.
85 changes: 0 additions & 85 deletions .github/workflows/ci.yml
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
53 changes: 53 additions & 0 deletions .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 }}
59 changes: 59 additions & 0 deletions .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 }}

1 comment on commit 6005735

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://remirror.io as production
🚀 Deployed on https://5f819d0bf2fb3ea28dd42fbb--remirror.netlify.app

Please sign in to comment.