1.3.0 #184
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: Deploy and publish | |
on: | |
push: | |
tags: | |
- v* | |
env: | |
FORCE_COLOR: 1 | |
permissions: write-all | |
jobs: | |
build_library: | |
runs-on: ubuntu-latest | |
name: Build library | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build app | |
run: npm run build | |
- name: Upload build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
build_storybook: | |
runs-on: ubuntu-latest | |
name: Build Storybook | |
needs: build_library | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Download library build | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Install dependencies | |
run: npm install | |
- name: Build Storybook | |
run: npm run build:storybook | |
- name: Upload Storybook build | |
uses: actions/upload-artifact@v3 | |
with: | |
name: storybook-static | |
path: storybook-static | |
test_library: | |
runs-on: ubuntu-latest | |
needs: build_storybook | |
name: Test library | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download library build | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Download Storybook build | |
uses: actions/download-artifact@v3 | |
with: | |
name: storybook-static | |
path: storybook-static | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm install | |
- name: Install browsers | |
run: npx playwright install | |
- name: Run Storybook tests | |
run: npm run test:ci | |
publish_npm: | |
name: Publish library to npm | |
runs-on: ubuntu-latest | |
needs: test_library | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Download build | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: "https://registry.npmjs.org" | |
- name: Publish @sikaeducation/ui to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
deploy_storybook: | |
name: Deploy Storybook to Netlify | |
runs-on: ubuntu-latest | |
needs: test_library | |
steps: | |
- name: Download Storybook build | |
uses: actions/download-artifact@v3 | |
with: | |
name: storybook-static | |
path: storybook-static | |
- name: Deploy Storybook to Netlify | |
uses: jsmrcaga/action-netlify-deploy@v2.0.0 | |
with: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
NETLIFY_DEPLOY_MESSAGE: "Deploy v${{ github.ref }}" | |
NETLIFY_DEPLOY_TO_PROD: true | |
build_directory: storybook-static | |
build_command: echo "Build exists, skipping npm run build" | |
install_command: echo "Install exists, skipping npm install" | |
create_release: | |
name: Create GitHub release | |
runs-on: ubuntu-latest | |
needs: test_library | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Publish release | |
uses: elgohr/Github-Release-Action@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
with: | |
title: Release |