Skip to content

Develop (#5)

Develop (#5) #34

Workflow file for this run

name: Release
env:
STORE_PATH: ""
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
defaults:
run:
shell: bash
jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-keys.outputs.key }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Get pnpm store directory
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
- name: Generate cache key
id: cache-keys
run: echo "key=$(echo ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }})" >> "$GITHUB_OUTPUT"
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: $STORE_PATH
key: ${{ steps.cache-keys.outputs.key }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
test:
name: Test
runs-on: ubuntu-latest
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Use Cached Dependencies
uses: actions/cache@v4
with:
path: $STORE_PATH
key: ${{ needs.prepare.outputs.cache-key }}
- name: Install dependencies
run: pnpm install
- name: Test
run: pnpm run test
build:
name: Build
runs-on: ubuntu-latest
needs: [prepare, test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Use Cached Dependencies
uses: actions/cache@v4
with:
path: $STORE_PATH
key: ${{ needs.prepare.outputs.cache-key }}
- name: Install dependencies
run: pnpm install
- name: Build Packages
run: pnpm run build
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: dist
path: ./dist
release:
name: Release & Publish
runs-on: ubuntu-latest
needs: [prepare, test, build]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Use Cached Dependencies
uses: actions/cache@v4
with:
path: $STORE_PATH
key: ${{ needs.prepare.outputs.cache-key }}
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: dist
path: ./dist
- name: Create Release Pull Request or Publish
uses: changesets/action@v1
with:
version: pnpm run release:version
publish: pnpm run release:publish
commit: "🎡[CI] Release"
title: "🎡[CI] Release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}