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

feat: Allows publishing on dev branch/distribution channel #162

Merged
merged 28 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a2d3d9b
feature(release-process): allows publishing on dev branch as a beta p…
tibuurcio Mar 20, 2024
ee74727
Commit generated CSS
tibuurcio Mar 20, 2024
63d4e8a
chore(release-process): adds dry-run to test release on CI
tibuurcio Mar 20, 2024
d5a7ef6
Merge branch 'dev' of https://github.com/mParticle/aquarium into dev
tibuurcio Mar 20, 2024
2d0ed91
Commit generated CSS
tibuurcio Mar 20, 2024
b5f88c1
build: runs style-dictionary on pre-commit hook instead of github action
tibuurcio Mar 20, 2024
325e0ea
build: removes header on style.ts file to stop changes on every commit
tibuurcio Mar 20, 2024
59bfad1
ci: removes next branch releases and dry-run
tibuurcio Mar 20, 2024
4d16414
chore: change beta to dev prerelease version naming
tibuurcio Mar 20, 2024
41af9ae
Update CONTRIBUTING.md
tibuurcio Mar 20, 2024
e3eb6a5
feature: updates package.json version with semantic-release
tibuurcio Mar 20, 2024
7f87110
Merge branch 'dev' of https://github.com/mParticle/aquarium into dev
tibuurcio Mar 20, 2024
3cd98e1
chore: install semantic-release/git dependency
tibuurcio Mar 20, 2024
b20e21b
chore(release): 1.8.3-dev.2 [skip ci]
mparticle-automation Mar 20, 2024
07086cb
chore: add changelog file
tibuurcio Mar 20, 2024
246579a
chore(release): 1.8.3-dev.2 [skip ci]
mparticle-automation Mar 20, 2024
f23800c
Merge branch 'dev' of https://github.com/mParticle/aquarium into dev
tibuurcio Mar 20, 2024
8c1623f
chore(release): 1.8.3-dev.3 [skip ci]
mparticle-automation Mar 20, 2024
7c465b1
Merge branch 'main' into dev
tibuurcio Mar 20, 2024
87c9436
chore: adds commitlint to lint commit messages
tibuurcio Mar 25, 2024
8d38b32
Merge branch 'main' into dev
tibuurcio Mar 25, 2024
d0c29a4
chore: documentation
tibuurcio Mar 25, 2024
1a5f6bb
chore(release): 1.9.6-dev.1 [skip ci]
mparticle-automation Mar 25, 2024
f9227f8
chore: remove branch name check on PR since we are planning to use de…
tibuurcio Mar 25, 2024
6fce604
chore: update package.json
tibuurcio Mar 26, 2024
76b22de
ci: adds new branch name check
tibuurcio Mar 26, 2024
c14dd07
chore: match branch names with release config
tibuurcio Mar 26, 2024
c011a61
fix: removes security vulnerability in workflow file
tibuurcio Mar 26, 2024
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
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
extraFileExtensions: ['.md', '.css'],
},
plugins: ['react', 'react-hooks'],
ignorePatterns: ['.eslintrc.js'],
ignorePatterns: ['.eslintrc.js', 'commitlint.config.js'],
rules: {
semi: 'off',
'@typescript-eslint/explicit-function-return-type': [
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/pr-branch-check-name.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: 'Branch Name PR Check'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make this a required check once its merger in?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's a config in settings right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the repo settings [branch protections] yes

on:
workflow_call:
pull_request:
types: [opened, reopened, synchronize, edited]
jobs:
pr-branch-name-check:
name: 'Check PR for semantic branch name'
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: 'Set PR branch validity'
id: is-semantic
if: >
startsWith(github.event.pull_request.head.ref, 'feat/') ||
startsWith(github.event.pull_request.head.ref, 'ci/') ||
startsWith(github.event.pull_request.head.ref, 'fix/') ||
startsWith(github.event.pull_request.head.ref, 'docs/') ||
startsWith(github.event.pull_request.head.ref, 'test/') ||
startsWith(github.event.pull_request.head.ref, 'refactor/') ||
startsWith(github.event.pull_request.head.ref, 'style/') ||
startsWith(github.event.pull_request.head.ref, 'build/') ||
startsWith(github.event.pull_request.head.ref, 'chore/') ||
startsWith(github.event.pull_request.head.ref, 'revert/') ||
startsWith(github.event.pull_request.head.ref, 'dependabot/') ||
startsWith(github.event.pull_request.head.ref, 'dev')
run: |
OUTPUT=true
echo "isSemantic=$OUTPUT" >> $GITHUB_OUTPUT
- name: 'echo isSemantic'
run: |
echo ${{ steps.is-semantic.outputs.isSemantic }}
- name: 'Branch name is valid'
if: ${{steps.is-semantic.outputs.isSemantic == 'true'}}
run: |
echo 'Pull request branch name is valid.'
echo ${{ steps.is-semantic.outputs.isSemantic }}
- name: 'Branch name is invalid'
if: ${{ steps.is-semantic.outputs.isSemantic != 'true'}}
run: |
echo ${{ steps.is-semantic.outputs.isSemantic }}
echo 'Pull request branch name is not valid.'
echo 'branch name must start with one of:'
echo ' feat/,'
echo ' ci/,'
echo ' fix/,'
echo ' docs/,'
echo ' test/,'
echo ' refactor/,'
echo ' style/,'
echo ' build/,'
echo ' chore/,'
echo ' revert/,'
echo ' dependabot/,'
echo ' dev'
exit 1
3 changes: 0 additions & 3 deletions .github/workflows/reusable-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
pull_request:

jobs:
pr-branch-check-name:
tibuurcio marked this conversation as resolved.
Show resolved Hide resolved
name: Check PR for semantic branch name
uses: mParticle/mparticle-workflows/.github/workflows/pr-branch-check-name.yml@stable
pr-title-check:
name: Check PR for semantic title
uses: mParticle/mparticle-workflows/.github/workflows/pr-title-check.yml@stable
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit "$1"
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## [1.9.6-dev.1](https://github.com/mParticle/aquarium/compare/v1.9.5...v1.9.6-dev.1) (2024-03-25)

## [1.8.3-dev.3](https://github.com/mParticle/aquarium/compare/v1.8.3-dev.2...v1.8.3-dev.3) (2024-03-20)
42 changes: 38 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Thanks for contributing! Please read this document to follow our conventions for
- Clone the repository and run `npm install`
- Run `npm start` to start storybook

## Testing in Nancy
## Testing in Nancy codebase

In order to test your changes, you will need to link the local version of the library. To do this, run the following commands:

Expand All @@ -17,6 +17,10 @@ In order to test your changes, you will need to link the local version of the li
- `yarn link @mparticle/aquarium` in the root of Nancy
- Make sure your _/node_modules/@mparticle/aquarium_ folder contains all of the Aquarium code

## Testing in Indicative codebase

TODO

## Testing by installing from a branch

Another way to test your changes is by installing the library from a branch. To do this, we need to push the _dist/_ folder to the remote
Expand All @@ -26,19 +30,25 @@ and install it directly from there with the following command:
yarn add https://github.com/mParticle/aquarium#<branch-name>
```

## Releasing
### Release Process

We use semantic-release for releasing new versions of the library.

## Releasing beta versions
## Releasing development versions

[TODO](https://mparticle-eng.atlassian.net/browse/UNI-264)
To test development version of the Aquarium we use the `dev` branch on Github and `dev` distribution channel on npm.
This allows us to install a version of the library by running the following command:

```
yarn add @mparticle/aquarium@dev
```

## Commit conventions and PR titles

- We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to help automating the release process. Both PR titles and commit messages should follow this convention.
- [This repo is commitizen friendly](https://github.com/commitizen/cz-cli?tab=readme-ov-file#using-the-command-line-tool) so we can use `git cz` to commit changes.
`npx cz` is also available if you don't have commitizen installed globally.
- We also have a [commitlint](https://commitlint.js.org/) setup to enforce the commit message format.

The standard format for commit messages is as follows:

Expand Down Expand Up @@ -72,3 +82,27 @@ In the footer, if there is a breaking change, start your footer with `BREAKING C
- Also, if you're using VSCode you might want to set prettier as the default formatter and also turn on "Format on Save" option.
- **ESLint**: Check [Integrations doc page](https://eslint.org/docs/latest/use/integrations)
- **Stylelint**: Check [Editor integrations doc page](https://stylelint.io/awesome-stylelint/#editor-integrations)

## Contributing with the release process

To make changes to the release process, you can use the `--dry-run` from semantic-release flag to test the release
process without actually publishing a new version.

You will need two environment variables to run the release process locally:

- NPM_TOKEN: You can create a personal npm account and use a personal token.
Since we are using `--dry-run` it won't try to publish anything so having a valid read-only npm token works.

- GITHUB_TOKEN: Create a [github personal access token (classic)](https://github.com/settings/tokens)
and give it access to the mParticle organization via "Configure SSO" button.

After settings both variables locally, run the following locally:

```
npx semantic-release --dry-run
```

## Additional readings:

- [Semantic Release Workflow Configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/workflow-configuration.md#workflow-configuration)
- [Understanding npm distribution channels](https://docs.npmjs.com/cli/v8/commands/npm-dist-tag#purpose)
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
extends: ['@commitlint/config-conventional'],
}
Loading
Loading