chore: release packages (#1179) #1013
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: Continuous Deployment | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout default branch | |
uses: actions/checkout@v4 | |
- name: Use pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "pnpm" | |
- name: Install npm dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Build the packages | |
run: pnpm build | |
- name: Cache the built artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: built-artifacts | |
path: packages/*/dist | |
if-no-files-found: error | |
lint: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout default branch | |
uses: actions/checkout@v4 | |
- name: Use pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "pnpm" | |
- name: Install npm dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-artifacts | |
path: packages | |
- name: Add app-bridge dependency for guideline-blocks-settings | |
run: pnpm add @frontify/app-bridge@workspace:^ --filter {packages/guideline-blocks-settings} | |
- name: Lint code | |
run: pnpm lint | |
typecheck: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout default branch | |
uses: actions/checkout@v4 | |
- name: Use pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "pnpm" | |
- name: Install npm dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-artifacts | |
path: packages | |
- name: Add app-bridge dependency for guideline-blocks-settings | |
run: pnpm add @frontify/app-bridge@workspace:^ --filter {packages/guideline-blocks-settings} | |
- name: Typecheck code | |
run: pnpm typecheck | |
unit-tests: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout default branch | |
uses: actions/checkout@v4 | |
- name: Use pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "pnpm" | |
- name: Install npm dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-artifacts | |
path: packages | |
- name: Add app-bridge dependency for guideline-blocks-settings | |
run: pnpm add @frontify/app-bridge@workspace:^ --filter {packages/guideline-blocks-settings} | |
- name: Test code | |
run: pnpm test | |
component-tests: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout current commit | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
- name: Use pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Setup pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
~/.cache/Cypress | |
key: pnpm-with-cypress-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
restore-keys: pnpm-with-cypress-${{ runner.os }}- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Download built artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-artifacts | |
path: packages | |
- name: Add app-bridge dependency for guideline-blocks-settings | |
run: pnpm add @frontify/app-bridge@workspace:^ --filter {packages/guideline-blocks-settings} | |
- name: Component Tests | |
run: pnpm test:components | |
publish: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
needs: [lint, typecheck, component-tests, unit-tests] | |
permissions: | |
contents: write # to create release (changesets/action) | |
pull-requests: write # to create pull request (changesets/action) | |
steps: | |
- name: Checkout default branch | |
uses: actions/checkout@v4 | |
- name: Use pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
run_install: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "pnpm" | |
- name: Install npm dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Create release PR or publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
commit: "chore: release packages" | |
title: "chore: release packages" | |
version: pnpm ci:version | |
publish: pnpm ci:publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |