Skip to content

Commit

Permalink
Merge pull request #2 from sourcefuse/release-package
Browse files Browse the repository at this point in the history
chore(ci-cd): changes to publish the package to npm
  • Loading branch information
yeshamavani authored Oct 22, 2024
2 parents 349b523 + 90894f6 commit da3dabd
Show file tree
Hide file tree
Showing 27 changed files with 9,261 additions and 2,157 deletions.
62 changes: 62 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module.exports = {
types: [
{value: 'feat', name: 'feat: A new feature'},
{value: 'fix', name: 'fix: A bug fix'},
{value: 'docs', name: 'docs: Documentation only changes'},
{
value: 'style',
name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)',
},
{
value: 'refactor',
name: 'refactor: A code change that neither fixes a bug nor adds a feature',
},
{
value: 'perf',
name: 'perf: A code change that improves performance',
},
{value: 'test', name: 'test: Adding missing tests'},
{
value: 'chore',
name: 'chore: Changes to the build process or auxiliary tools\n and libraries such as documentation generation',
},
{value: 'revert', name: 'revert: Reverting a commit'},
{value: 'WIP', name: 'WIP: Work in progress'},
],

scopes: [
{name: 'deps'},
{name: 'docs'},
{name: 'chore'},
{name: 'ci-cd'},
{name: 'component'},
{name: 'provider'},
],

appendBranchNameToCommitMessage: true,
appendIssueFromBranchName: true,
allowTicketNumber: false,
isTicketNumberRequired: false,

// override the messages, defaults are as follows
messages: {
type: "Select the type of change that you're committing:",
scope: 'Denote the SCOPE of this change:',
// used if allowCustomScopes is true
customScope: 'Denote the SCOPE of this change:',
subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
body: 'Provide a LONGER description of the change (mandatory). Use "\\n" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional):\n',
footer: 'List any ISSUES CLOSED by this change (optional). E.g.: GH-144:\n',
confirmCommit: 'Are you sure you want to proceed with the commit above?',
},

allowCustomScopes: false,
allowBreakingChanges: ['feat', 'fix'],

// limit subject length
subjectLimit: 100,
breaklineChar: '|', // It is supported for fields body and footer.
footerPrefix: '',
askForBreakingChangeFirst: true, // default is false
};
8 changes: 8 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
node_modules/
dist/
coverage/
api-docs/
typing/
src/__tests__/

index.*
.cz-config.js
commitlint.config.js

.eslintrc.js
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports = {
rules: {
'no-extra-boolean-cast': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'no-prototype-builtins': 'off',
},
parserOptions: {
project: './tsconfig.json',
Expand Down
76 changes: 76 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
60 changes: 60 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# loopback4-billing

## Contributing

First off, thank you for considering contributing to the project. It's people like you that helps in keeping this extension useful.

### Where do I go from here ?

If you've noticed a bug or have a question, [search the issue tracker](https://github.com/sourcefuse/loopback4-billing/issues) to see if
someone else in the community has already created a ticket. If not, go ahead and
[make one](https://github.com/sourcefuse/loopback4-billing/issues/new/choose)!

### Fork & create a branch

If this is something you think you can fix, then [fork](https://help.github.com/articles/fork-a-repo) this repo and
create a branch with a descriptive name.

A good branch name would be (where issue #325 is the ticket you're working on):

```sh
git checkout -b 325-add-new-feature
```

### Make a Pull Request

At this point, you should switch back to your master branch and make sure it's
up to date with loopback4-billing's master branch:

```sh
git remote add upstream [email protected]:sourcefuse/loopback4-billing.git
git checkout master
git pull upstream master
```

Then update your feature branch from your local copy of master, and push it!

```sh
git checkout 325-add-new-feature
git rebase master
git push --set-upstream origin 325-add-new-feature
```

Finally, go to GitHub and [make a Pull Request](https://help.github.com/articles/creating-a-pull-request).

### Keeping your Pull Request updated

If a maintainer asks you to "rebase" your PR, they're saying that a lot of code
has changed, and that you need to update your branch so it's easier to merge.

To learn more about rebasing in Git, there are a lot of [good][git rebasing]
[resources][interactive rebase] but here's the suggested workflow:

```sh
git checkout 325-add-new-feature
git pull --rebase upstream master
git push --force-with-lease 325-add-new-feature
```

[git rebasing]: http://git-scm.com/book/en/Git-Branching-Rebasing
[interactive rebase]: https://help.github.com/articles/interactive-rebase
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Intermediate change (work in progress)

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B

## Checklist:

- [ ] Performed a self-review of my own code
- [ ] npm test passes on your machine
- [ ] New tests added or existing tests modified to cover all changes
- [ ] Code conforms with the style guide
- [ ] API Documentation in code was updated
- [ ] Any dependent changes have been merged and published in downstream modules
27 changes: 27 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

# This workflow contains a single job called "npm_test"
jobs:
npm_test:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: Install Dependencies πŸ“Œ
run: npm ci

- name: Run Test Cases πŸ”§
run: npm run test
52 changes: 52 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This Manually Executable Workflow is for NPM Releases

name: Release [Manual]
on: workflow_dispatch
permissions:
contents: write
jobs:
Release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# fetch-depth is necessary to get all tags
# otherwise lerna can't detect the changes and will end up bumping the versions for all packages
fetch-depth: 0
token: ${{ secrets.RELEASE_COMMIT_GH_PAT }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Configure CI Git User
run: |
git config --global user.name $CONFIG_USERNAME
git config --global user.email $CONFIG_EMAIL
git remote set-url origin https://$GITHUB_ACTOR:[email protected]/sourcefuse/loopback4-billing
env:
GITHUB_PAT: ${{ secrets.RELEASE_COMMIT_GH_PAT }}
CONFIG_USERNAME: ${{ vars.RELEASE_COMMIT_USERNAME }}
CONFIG_EMAIL: ${{ vars.RELEASE_COMMIT_EMAIL }}
- name: Authenticate with Registry
run: |
echo "@${NPM_USERNAME}:registry=https://registry.npmjs.org/" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
npm whoami
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_USERNAME: ${{ vars.NPM_USERNAME }}

- name: Install πŸ“Œ
run: |
npm install
- name: Test πŸ”§
run: npm run test
- name: Semantic Publish to NPM πŸš€
# "HUSKY=0" disables pre-commit-msg check (Needed in order to allow semantic-release perform the release commit)
run: HUSKY=0 npx semantic-release
env:
GH_TOKEN: ${{ secrets.RELEASE_COMMIT_GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Changelog πŸ“
run: cd src/release_notes && HUSKY=0 node release-notes.js
Loading

0 comments on commit da3dabd

Please sign in to comment.