Skip to content

Commit

Permalink
ci: 🎡 setup (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
theashraf authored Oct 30, 2023
1 parent 66e9469 commit 1aeb9db
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 135 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: main
on:
push:
branches:
- 'main'
pull_request:

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.0

- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup pnpm@v8
uses: pnpm/action-setup@v2
with:
version: 8

- name: ⎔ Setup Node@v18
uses: actions/setup-node@v4
with:
node-version: 18

- name: 📥 Download deps
run: pnpm install

- name: 🏗 Build
run: pnpm build

- name: 🔍 Verify types
run: pnpm type-check

- name: 🕵️ Lint
run: pnpm lint:prod

- name: 💅 Verify format (`pnpm format` committed?)
run: pnpm format

- name: 🛡️ Test
run: pnpm test

release:
name: release
needs: validate
runs-on: ubuntu-latest
if: ${{ github.repository == 'LottieFiles/dotlottie-web' && github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: ⎔ Setup pnpm@v8
uses: pnpm/action-setup@v2
with:
version: 8

- name: ⎔ Setup Node@v18
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: 18
registry-url: 'https://registry.npmjs.org'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}

- name: ⎔ Setup .npmrc (NPM)
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_TOKEN }}" >> ~/.npmrc

- name: 📥 Install dependencies
run: pnpm install

- name: 🚀 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:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}

- name: Remove existing NPM .npmrc
run: rm -f "$HOME/.npmrc"

- name: ⎔ Setup Node@v18 for Github Packages
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: 18
registry-url: 'https://npm.pkg.github.com/'

- name: 📥 Install dependencies
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}

- name: 🚀 Release to Github Packages
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.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets. NPM_TOKEN }}
47 changes: 0 additions & 47 deletions .github/workflows/tests.yml

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"license": "MIT",
"private": true,
"workspaces": [
"packages/renderers/*",
"packages/*",
"scripts/"
],
Expand All @@ -29,6 +28,8 @@
"release:version": "changeset version",
"stats:eslint": "cross-env TIMING=1 turbo run stats:eslint",
"stats:ts": "turbo run stats:ts",
"test": "turbo run test",
"test:coverage": "turbo run test:coverage",
"type-check": "turbo run type-check"
},
"devDependencies": {
Expand All @@ -50,5 +51,5 @@
"turbo": "1.9.3",
"typescript": "5.0.4"
},
"packageManager": "pnpm@7.1.6"
"packageManager": "pnpm@8.9.2"
}
107 changes: 22 additions & 85 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
packages:
- 'packages/renderers/*'
- 'packages/*'
- 'scripts/'

0 comments on commit 1aeb9db

Please sign in to comment.