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

deploy: simple deployment to prod #52

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
5 changes: 5 additions & 0 deletions .cz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tool.commitizen]
version = "0.1.0"
version_files = ["package.json:version", "VERSION"]
update_changelog_on_bump = true
major_version_zero = true
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'prettier',
],
ignorePatterns: ['!.prettierrc.js'],
ignorePatterns: ['!**/.prettierrc.js'],
rules: {
'no-unused-vars': 'off',
'no-console': 'warn',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ name: 'CodeQL'

on:
push:
branches: ['main', 'staging', 'dev']
branches: ['main', 'dev']
pull_request:
branches: ['main', 'staging', 'dev']
branches: ['main', 'dev']
schedule:
- cron: '26 3 * * 6'

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Code Lint and Test

on:
push:
branches: ['main', 'staging', 'dev']
branches: ['main', 'dev']
pull_request:
branches: ['main', 'staging', 'dev']
branches: ['main', 'dev']

jobs:
lint:
Expand All @@ -22,7 +22,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d
with:
version: 8
version: 9
run_install: true

- name: 🔬 Lint
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release

on:
push:
branches: [main]

jobs:
release:
# create a release following the logic below:
# 1. branch is `main` AND
# 2. workflow is triggered by a push event AND
# 3. the head commit's commit message does NOT starts with `bump:`
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' && ! startsWith(github.event.head_commit.message , 'bump:') }}
name: ⬆️ Bump version and create changelog with a GitHub release
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
token: ${{ secrets.SVC_PAT }}

- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@ee36ca9396bdc21d6003d1e045bfecf26ad85029
with:
github_token: ${{ secrets.SVC_PAT }}
changelog_increment_filename: body.md

- name: Release
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974
with:
body_path: 'body.md'
tag_name: ${{ env.REVISION }} # this is the version set in the previous step
token: ${{ secrets.SVC_PAT }}
generate_release_notes: true
Empty file added CHANGELOG.md
Empty file.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ This project is using [conventional commits](https://www.conventionalcommits.org
- **Branches**:

- `main` is the production mainline.
- `staging` is the staging line.
- `dev` is the development line.

- **PR merge strategy on Github**
- Code should flow in the following direction through branches:
```
feature/bug fix -> dev -> staging -> main
feature/bug fix -> dev -> main
```
- We'll be keeping a linear commit history and so using a combination of `Rebase and merge` and `Squash and merge` merge strategies.
- Use `Rebase and merge` as **_default_** to ensure all commits from the branch to be merged are brought in individually to the target branch.
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
89 changes: 50 additions & 39 deletions stage.eslint.config.js → eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,39 +1,67 @@
module.exports = [
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import unusedImports from 'eslint-plugin-unused-imports';
import cypress from 'eslint-plugin-cypress';
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ['!**/.prettierrc.js'],
},
...compat.extends(
'eslint:recommended',
'next',
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'prettier',
),
{
env: {
browser: true,
es2021: true,
node: true,
},
plugins: {
'@typescript-eslint': require('@typescript-eslint/eslint-plugin'),
'simple-import-sort': import('eslint-plugin-simple-import-sort'),
'unused-imports': require('eslint-plugin-unused-imports'),
cypress: require('eslint-plugin-cypress'),
'@typescript-eslint': typescriptEslint,
'simple-import-sort': simpleImportSort,
'unused-imports': unusedImports,
cypress,
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
React: true,
JSX: true,
},
},
extends: [
'eslint:recommended',
'next',
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'prettier',
],
ignorePatterns: ['!.prettierrc.js'],

rules: {
'no-unused-vars': 'off',
'no-console': 'warn',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'react/no-unescaped-entities': 'off',

'react/display-name': 'off',

'react/jsx-curly-brace-presence': [
'warn',
{ props: 'never', children: 'never' },
{
props: 'never',
children: 'never',
},
],

//#region //*=========== Unused Import ===========
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'warn',

'unused-imports/no-unused-vars': [
'warn',
{
Expand All @@ -43,29 +71,20 @@ module.exports = [
argsIgnorePattern: '^_',
},
],
//#endregion //*======== Unused Import ===========

//#region //*=========== Import Sort ===========
'simple-import-sort/exports': 'warn',

'simple-import-sort/imports': [
'warn',
{
groups: [
// ext library & side effect imports
['^@?\\w', '^\\u0000'],
// {s}css files
['^.+\\.s?css$'],
// Lib and hooks
['^@/lib', '^@/hooks'],
// static data
['^@/data'],
// components
['^@/components', '^@/container'],
// zustand store
['^@/store'],
// Other imports
['^@/'],
// relative paths up until 3 level
[
'^\\./?$',
'^\\.(?!/?$)',
Expand All @@ -77,25 +96,17 @@ module.exports = [
'^\\.\\./\\.\\./\\.\\.(?!/?$)',
],
['^@/types'],
// other that didnt fit in
['^'],
],
},
],
//#endregion //*======== Import Sort ===========

// #region //*========= Cypress files =========
'@typescript-eslint/no-namespace': [
'error',
{
allowDeclarations: true,
},
],
// #endregion //*========= Cypress files =========
},
globals: {
React: true,
JSX: true,
},
},
];
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"@radix-ui/react-dropdown-menu": "latest",
"@radix-ui/react-slider": "latest",
"@radix-ui/react-slot": "latest",
"@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-toast": "latest",
"class-variance-authority": "latest",
"clsx": "latest",
"jotai": "latest",
"jotai-cache": "^0.5.0",
"jotai-cache": "latest",
"jotai-effect": "latest",
"lucide-react": "latest",
"moment": "latest",
Expand All @@ -44,6 +44,8 @@
"devDependencies": {
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@eslint/eslintrc": "latest",
"@eslint/js": "latest",
"@release-it/conventional-changelog": "latest",
"@types/node": "latest",
"@types/react": "latest",
Expand All @@ -52,12 +54,13 @@
"@typescript-eslint/parser": "latest",
"autoprefixer": "latest",
"cypress": "latest",
"eslint": "8.56.0",
"eslint": "^8.57.1",
"eslint-config-next": "latest",
"eslint-config-prettier": "latest",
"eslint-plugin-cypress": "latest",
"eslint-plugin-cypress": "^3.6.0",
"eslint-plugin-simple-import-sort": "latest",
"eslint-plugin-unused-imports": "latest",
"globals": "latest",
"husky": "latest",
"lint-staged": "latest",
"next-sitemap": "latest",
Expand All @@ -79,6 +82,6 @@
},
"engines": {
"node": "20.x",
"pnpm": "8.x"
"pnpm": "9.x"
}
}
Loading
Loading