-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from aditya-likeminds/feature/LM-10114
[LM-10114] CI Implementation
- Loading branch information
Showing
4 changed files
with
160 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters