Skip to content

Commit

Permalink
chore(ci): set a seperate publish workflow for v1 (#1694)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Jun 6, 2022
1 parent ef1596e commit 86293b0
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
99 changes: 99 additions & 0 deletions .github/workflows/publish-v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: publish

on:
workflow_run:
workflows: [ci]
branches: [v1-hotfix]
types: [completed]

env:
PNPM_CACHE_FOLDER: .pnpm-store

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

steps:
- name: checkout code repository
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: 'origin/v1-hotfix'

- 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
with:
node-version: 14

- name: install and audit
uses: ./support/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 }}

- 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: v1-hotfix
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: v1-hotfix
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: v1-hotfix
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
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: publish
on:
workflow_run:
workflows: [ci]
branches: [main, v2, v1-hotfix]
branches: [main]
types: [completed]

env:
Expand Down

0 comments on commit 86293b0

Please sign in to comment.