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

Setup CI/CD pipeline #1

Merged
merged 1 commit into from
Aug 21, 2024
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
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is define code owners of the repository, more details about the GitHub feature here https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

- @hamikhambardzumyan
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 to NPM
on:
pull_request:
types:
- closed
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: 📥 Install dependencies
run: npm install
- name: 🔧 Build
run: npm run build
- name: 📦 Publish package on NPM
run: cd dist && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_ACCESS_TOKEN }}
- name: 🚀 Run bump up commit
run: |
git config --global user.name "Hamik Hambardzumyan"
git config --global user.email "hamik.hambardzumyan@softconstruct.com"
npm run bump-up-commit
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"create-icon": "babel-node --config-file ./configs/.babelrc ./scripts/createIcon.js",
"remove-icon": "babel-node --config-file ./configs/.babelrc ./scripts/removeIcon.js",
"update-icon": "",
"mark-as-deprecated": ""
"mark-as-deprecated": "",
"bump-up-commit": "babel-node --config-file ./configs/.babelrc ./scripts/postPublish.js"
},
"files": [
"dist/*"
Expand Down
12 changes: 12 additions & 0 deletions scripts/postPublish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { execCommand } from './utils';
import pgk from '../package.json';

const filesToCommit = 'package.json package-lock.json'; // TODO: add CHANGELOG.md file
const commitMessage = `Bump up library version to ${pgk.version}`;
const tagName = `v${pgk.version}`;
const defaultBranch = 'main';

execCommand(
`git add ${filesToCommit} && git commit -m '${commitMessage}' && git push origin ${defaultBranch}`
);
execCommand(`git tag ${tagName} && git push origin ${tagName}`);
Loading