Skip to content

feat: v2

feat: v2 #784

Workflow file for this run

name: Release
on:
push:
branches: main
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: Validate
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['20']
steps:
- name: ⬇ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v4
- name: ⎔ Setup Node.js ${{ matrix.node-version }} for Validate
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
- name: 📥 Install dependencies
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 🏗 Build
run: pnpm clean && pnpm build
- name: 🔍 Verify types
run: pnpm type-check
- name: 💅 Verify format
run: pnpm format --check --no-write
- name: 🕵️ Lint
run: pnpm lint:prod
- name: 🛡️ Test
run: pnpm test
- name: 📏 Report bundle size
if: github.event.pull_request.merged == 'pull_request'
uses: andresz1/size-limit-action@v1
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release-npm:
name: Release to NPM
needs: validate
runs-on: ubuntu-latest
if: ${{ github.repository == 'LottieFiles/relottie' && github.event_name == 'push' }}
strategy:
matrix:
node-version: ['20']
permissions:
contents: write # Allow creating a release in the repository
id-token: write # Required for provenance
packages: write # Required for publishing
pull-requests: write # Required for creating a release PR
steps:
- name: ⬇ Checkout repo
uses: actions/checkout@v4
with:
# https://github.com/changesets/action/issues/201#issuecomment-1206088289
# check out all commits and tags so changeset can skip duplicate tags
fetch-depth: 0
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v4
- name: ⎔ Setup Node.js ${{ matrix.node-version }} for NPM
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
- name: 📥 Install dependencies
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: 🚀 Create Release Pull Request or Release to NPM
uses: changesets/action@v1
with:
commit: 'chore: 🤖 update versions'
title: 'chore: 🤖 update versions'
publish: pnpm release:publish
version: pnpm release:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
release-gpr:
name: Release to GPR
needs: [validate, release-npm]
runs-on: ubuntu-latest
if: ${{ github.repository == 'LottieFiles/relottie' && github.event_name == 'push' }}
strategy:
matrix:
node-version: ['20']
permissions:
contents: write # Allow creating a release in the repository
id-token: write # Required for provenance
packages: write # Required for publishing
pull-requests: write # Required for creating a release PR
steps:
- name: ⬇ Checkout repo
uses: actions/checkout@v4
# https://github.com/changesets/action/issues/201#issuecomment-1206088289
# check out all commits and tags so changeset can skip duplicate tags
with:
fetch-depth: 0
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v4
- name: ⎔ Setup Node.js ${{ matrix.node-version }} for Github Packages
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com/
- name: 📥 Install dependencies for Github Packages
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 🚀 Release to Github Packages
uses: changesets/action@v1
with:
commit: 'chore: update versions'
title: 'chore: update versions'
publish: pnpm release:publish --no-git-tag
version: pnpm release:version
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}