Skip to content

Commit

Permalink
⚙️ Chore(enviroment): change CI/CD Github Actions, scripts at package…
Browse files Browse the repository at this point in the history
…s and husky flow
  • Loading branch information
INeedJobToStartWork committed Jun 14, 2024
1 parent eaa9dd8 commit fdd5849
Show file tree
Hide file tree
Showing 6 changed files with 473 additions and 1,012 deletions.
23 changes: 23 additions & 0 deletions .github/common-actions/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "install"
description: "Sets up Node.js and runs install"

runs:
using: "composite"
steps:
- name: 🚀 Setup pnpm
uses: pnpm/[email protected]
- name: 🟢 Setup node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org"
cache: "pnpm"

- name: 🤖 Setup Git User
shell: bash
run: |
git config --global user.email "[email protected]"
git config --global user.name "INEEDJ"
- name: ↘️ Install dependencies
shell: bash
run: pnpm install --no-frozen-lockfile
33 changes: 10 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
name: CI

name: CI/CD
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize]

branches: [main]
jobs:
Continuous-Integration:
Deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/[email protected]
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Format Files
- name: 🟢 Setup
uses: ./.github/common-actions/install
- name: 📝 Lint
run: pnpm lint
- name: ♻️ Format
run: pnpm format
- name: Linting Files
run: pnpm lint:fix --force && pnpm lint --force
env:
ESLINT_USE_FLAT_CONFIG: ${{ secrets.ESLINT_USE_FLAT_CONFIG }}
- name: Building Files
run: pnpm build
- name: Start Files
run: pnpm start
- name: 🏗️ Build Package
run: pnpm build:npm
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package to npmjs
on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: 🟢 Setup
uses: ./.github/common-actions/install

- name: 🗨️ Create Release Pull Request or Publish to NPM
id: changesets
uses: changesets/action@v1
with:
publish: pnpm npm:publish --no-git-checks --tag latest
title: "🤖 ci(changesets): :package: version packages"
commit: "🤖 ci(changesets): version packages"
setupGitUser: false
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }}
6 changes: 2 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

pnpm pre:husky
#!/bin/sh
npm run pre:husky
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,24 @@
"private": true,
"type": "module",
"scripts": {
"dev": "turbo dev",
"build": "turbo build",
"build:npm": "turbo build:npm",
"dev": "turbo dev",
"start": "turbo start",
"lint": "turbo lint",
"lint:fix": "turbo lint:fix",
"format": "turbo format",
"clean": "turbo clean",
"npm:prepack": "turbo npm:prepack",
"npm:postpack": "turbo npm:postpack",
"npm:publish": "turbo npm:publish",
"preinstall": "husky install",
"npm:version": "changeset version",
"npm:publish": "changeset publish",
"preinstall": "husky init",
"pre": "turbo pre",
"pre:husky": "git add . && npx lint-staged"
"pre:husky": "git add . && lint-staged",
"prepare": "husky",

"test": "echo \"Error: no test specified\""
},
"devDependencies": {
"@changesets/cli": "^2.27.5",
Expand Down
Loading

0 comments on commit fdd5849

Please sign in to comment.