Release/v1.3.2 #114
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish release | |
env: | |
CI: true | |
PNPM_CACHE_FOLDER: .pnpm-store | |
GIT_AUTHOR_NAME: GitHub Actions Bot | |
GIT_AUTHOR_EMAIL: <> | |
GIT_COMMITTER_NAME: GitHub Actions Bot | |
GIT_COMMITTER_EMAIL: <> | |
# only trigger on pull request closed events | |
on: | |
pull_request: | |
types: [closed] | |
branches: [master] | |
jobs: | |
test: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/install | |
- run: pnpm run lint | |
- run: pnpm run test | |
env: | |
NODE_OPTIONS: --max-old-space-size=8192 | |
build: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/install | |
- run: pnpm run build-storybook | |
- name: Archive screenshots | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v1 | |
with: | |
name: loki-screenshots | |
path: packages/ui/.loki | |
chromatic-deployment: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
needs: [test, build] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/install | |
- name: Publish to Chromatic | |
uses: chromaui/action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
exitZeroOnChanges: true | |
workingDir: packages/ui | |
autoAcceptChanges: true | |
publish_canary: | |
if: github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/v') | |
runs-on: ubuntu-latest | |
needs: [test, build] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/install | |
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish to npm | |
run: pnpm run publish-canary | |
publish_release: | |
# this job will only run if the PR has been merged | |
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Release Format | |
id: check-release | |
run: | | |
if [[ ${{ github.head_ref }} =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo ::set-output name=match::true | |
fi | |
- name: Create tag | |
if: steps.check-release.outputs.match == 'true' | |
id: create_tag | |
run: | | |
tag=$(echo ${{ github.event.pull_request.head.ref }} | sed 's/release\///') | |
echo ::set-output name=tag::$tag | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/install | |
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish to npm | |
if: steps.check-release.outputs.match == 'true' | |
run: | | |
git tag --force ${{ steps.create_tag.outputs.tag }} -m "tag release ${{ steps.create_tag.outputs.tag }}" | |
git push -f origin ${{ steps.create_tag.outputs.tag }} | |
pnpm run publish-release |