Skip to content

Commit

Permalink
Merge pull request #230 from aditya-likeminds/feature/LM-10114
Browse files Browse the repository at this point in the history
[LM-10114] CI Implementation
  • Loading branch information
omenUchiha authored Nov 13, 2023
2 parents 8a1afab + 17ca818 commit e30bc5b
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 2 deletions.
39 changes: 39 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
],
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"react"
],
"rules": {
"@typescript-eslint/indent": ["error", 2],
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "error"
}
}
64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish and Create Tag and Release

on:
push:
branches:
- "master"

permissions: write-all

jobs:
create_tag:
name: Create Git Tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check for version changes
run: |
# Fetch all tags from the remote repository
git fetch --tags
# Get the previous version from the last release tag
export previous_version=$(git describe --tags --abbrev=0)
# Get the current version from package.json
export current_version=$(cat package.json | grep '"version":' | awk -F'"' '{print $4}')
if [[ "$previous_version" != "v$current_version" ]]; then
echo "Version has changed from $previous_version to v$current_version."
else
echo "Version has not changed."
exit 1
fi
- name: Push Git Tag
run: |
# Git login
git config --global user.name "$(git log -n 1 --pretty=format:%an)"
git config --global user.email "$(git log -n 1 --pretty=format:%ae)"
# Push a Git tag with the new version
export current_version=$(cat package.json | grep '"version":' | awk -F'"' '{print $4}')
git tag -a "v$current_version" -m "Version $current_version"
git push origin "v$current_version"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: create_tag
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Create Release
run: gh release create "$(git describe --tags --abbrev=0)" --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint

on:
pull_request:
branches:
- "*"

jobs:
run-eslint:
name: ESLint
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18

- name: Install Node.js dependencies
run: npm i

# ESLint and Prettier must be in `package.json`
- name: ESLint
run: npm run lint

run-prettier:
name: Prettier
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18

- name: Install Node.js dependencies
run: npm i

- name: Prettier
run: npm run prettier
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "likeminds-chat-sx-rt",
"version": "0.1.0",
"version": "1.11.0-beta",
"private": true,
"dependencies": {
"@emotion/react": "11.10.5",
Expand Down Expand Up @@ -36,7 +36,11 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write ."
},
"eslintConfig": {
"extends": [
Expand All @@ -57,8 +61,13 @@
]
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"autoprefixer": "^10.4.13",
"eslint": "^8.53.0",
"eslint-plugin-react": "^7.33.2",
"postcss": "^8.4.19",
"prettier": "^3.0.3",
"tailwindcss": "^3.2.4",
"typescript": "^5.0.4"
}
Expand Down

0 comments on commit e30bc5b

Please sign in to comment.