Skip to content

Publish

Publish #877

Workflow file for this run

name: Publish
on:
push:
tags:
- '*'
schedule:
- cron: 0 11 * * *
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Lint the codebase
run: npm run lint:ci
test:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Run tests
run: npm run test:ci
- name: Upload coverage
uses: actions/upload-artifact@v2.2.4
with:
name: test_coverage
path: coverage
build_code:
name: Build code
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Run tests
run: npm run build:ci
- name: Upload dist
uses: actions/upload-artifact@v2.2.4
with:
name: dist
path: dist
integration_tests:
name: Run integration tests
runs-on: ubuntu-latest
needs: build_code
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Download dist/ folder
uses: actions/download-artifact@v2.0.10
with:
name: dist
path: dist
- name: Run integration tests
run: npm run test:integration:ci
build_docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build storybook
run: npm run docs:ci
- name: Upload the storybook
uses: actions/upload-artifact@v2.2.4
with:
name: docs
path: docs
deploy_docs:
needs: build_docs
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Download storybook
uses: actions/download-artifact@v2.0.10
with:
name: docs
path: docs
- name: Fetch all
run: git fetch --all
- name: Get the latest tag version
id: get-last-tag
run: |
last_tag=$( git describe --tags --abbrev=0 )
echo "::set-output name=LAST_TAG::${last_tag}"
- name: Deploy Docs to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2.5.0
with:
target_branch: '${{ secrets.DOCS_TARGET_BRANCH }}'
build_dir: docs
committer_name: '${{ secrets.AUTOCOMMITTER_NAME }}'
committer_email: '${{ secrets.AUTOCOMMITTER_EMAIL }}'
commit_message: 'Update docs for package v${{ steps.get-last-tag.LAST_TAG }}'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
GITHUB_PAT: '${{ secrets.GH_PAT }}'
publish:
needs: [lint, test, build_code, build_docs, integration_tests]
name: Publish to npm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.4.0
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
NPM_TOKEN: '${{ secrets.NPM_AUTH_TOKEN }}'