Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: 🤖 setup CI/CD #11

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/'
Loading