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

ci(repo): create npm publish workflow #100

Merged
merged 3 commits into from
Apr 4, 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
9 changes: 3 additions & 6 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,17 @@ jobs:
with:
node-version: "18" # Specify a Node.js version

- name: Remove package-lock.json # This is to work around https://github.com/npm/cli/issues/4828
run: rm -f package-lock.json

- name: Install dependencies
run: npm install

- name: Lint last commit message
run: npx commitlint --from=${{ github.event.pull_request.base.sha }} --to=${{ github.event.pull_request.head.sha }} --verbose

- name: Run Prettier
run: lerna run prettify
run: npm run format

- name: Run ESLint
run: lerna run lint
run: npm run lint

- name: Commit and push if changes
run: |
Expand All @@ -40,7 +37,7 @@ jobs:
git checkout ${{ github.head_ref }}

# Add, commit, and push changes, ignoring package-lock.json
git diff --name-only | grep -v 'package-lock.json' | xargs git add
git diff --name-only | xargs git add
git diff --staged --quiet || git commit -m "Apply Prettier formatting"
git push origin ${{ github.head_ref }}
env:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/multitenancy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ jobs:
with:
node-version: "18" # Specify a Node.js version

# This is to force nx arch-specific packages to correctly install
# This is to work around https://github.com/npm/cli/issues/4828
- name: Remove package-lock.json
run: rm -f package-lock.json

- name: Install dependencies
run: npm install

Expand Down
64 changes: 18 additions & 46 deletions .github/workflows/tag-and-publish.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
name: Tag and publish a new version

on:
workflow_dispatch:
inputs:
version:
description: "Version"
required: true
workflow_run:
workflows:
[
"Single Tenant Integration Tests",
"Multitenant Integration Tests",
"SaaS Integration Tests",
]
types:
- completed

jobs:
tag-and-publish:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success' &&
(github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'alpha')
environment:
name: publish
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.5
env:
discovery.type: single-node
cluster.name: docker-cluster
bootstrap.memory_lock: true
xpack.security.enabled: false
ES_JAVA_OPTS: -Xms1024m -Xmx1024m
ports:
- 9200:9200
- 9300:9300
zeebe:
image: camunda/zeebe:8.4.5
env:
JAVA_TOOL_OPTIONS: "-Xms512m -Xmx512m"
ZEEBE_BROKER_EXPORTERS_ELASTICSEARCH_CLASSNAME: io.camunda.zeebe.exporter.ElasticsearchExporter
ZEEBE_BROKER_EXPORTERS_ELASTICSEARCH_ARGS_URL: http://elasticsearch:9200
ZEEBE_BROKER_EXPORTERS_ELASTICSEARCH_ARGS_BULK_SIZE: 1
ZEEBE_BROKER_BACKPRESSURE_ENABLED: false
ports:
- 26500:26500
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -42,32 +27,19 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: "18"
cache: "npm"
- name: Install
run: npm ci --ignore-scripts
- name: Run integration tests
run: npm run test:integration
- name: Run tests
run: npm run test
- name: Run local integration tests
run: npm run test:local
- name: Build
run: npm run build
- name: Set version
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
npm version ${{ inputs.version }} -m "Publish v%s"
- name: Publish to NPM
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access=public
- name: Push changes
run: git push --follow-tags

- name: Build Docs
run: npm run docs
- name: Semantic Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Deploy Docs
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
13 changes: 13 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ src
.vscode
.husky
docs
coverage
zeebe-extra
commitlint.config.js
.editorconfig
.eslintrc.js
.prettier*
prettier*
ts-jest.log
.eslintignore
.releaserc
typedoc.json
lerna.json
docker*
14 changes: 8 additions & 6 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"branches": ["main"],
"repositoryUrl": "https://github.com/camunda-community-hub/camunda-8-js-sdk.git",
"branches": [
"main",
{
"name": "alpha",
"prerelease": true
}
],
"repositoryUrl": "https://github.com/camunda/camunda-8-js-sdk.git",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
{
"path": "semantic-release-lerna",
"generateNotes": false
},
"@semantic-release/github",
"@semantic-release/git"
]
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Bug Fixes

- REST getForm returns a flattened shape of the form compared to GraphQL ([58ec6d1](https://github.com/camunda-community-hub/camunda-8-js-sdk/commit/58ec6d1de08e39cb4699326b67ebbf6a398fb30f))
- REST getForm returns a flattened shape of the form compared to GraphQL ([58ec6d1](https://github.com/camunda/camunda-8-js-sdk/commit/58ec6d1de08e39cb4699326b67ebbf6a398fb30f))

### Features

- configure specs to import configuration from .env file ([00804d1](https://github.com/camunda-community-hub/camunda-8-js-sdk/commit/00804d132c0e1840846a5af9eee26351f9580c74))
- **tasklist:** enable multiple clusters via constructor options ([#16](https://github.com/camunda-community-hub/camunda-8-js-sdk/issues/16)) ([fb12e25](https://github.com/camunda-community-hub/camunda-8-js-sdk/commit/fb12e258321e6bba03d11d38119c740f0e242773))
- configure specs to import configuration from .env file ([00804d1](https://github.com/camunda/camunda-8-js-sdk/commit/00804d132c0e1840846a5af9eee26351f9580c74))
- **tasklist:** enable multiple clusters via constructor options ([#16](https://github.com/camunda/camunda-8-js-sdk/issues/16)) ([fb12e25](https://github.com/camunda/camunda-8-js-sdk/commit/fb12e258321e6bba03d11d38119c740f0e242773))
33 changes: 22 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,31 @@ Thank you for considering contributing to @camunda8/sdk! We welcome contribution
To get started with contributing, please follow these steps:

1. Fork the repository and clone it to your local machine.
2. Install the dependencies by running `npm install`.
3. Make your changes or additions to the codebase.
4. Write tests to cover your changes and ensure existing tests pass.
5. Run the tests using `npm test` to make sure everything is working correctly.
6. Commit your changes and push them to your forked repository.
7. Submit a pull request to the main repository.
2. Check out the `alpha` branch. This is the development branch.
3. Install the dependencies by running `npm install`.
4. Make your changes or additions to the codebase.
5. Write tests to cover your changes and ensure existing tests pass.
6. Run the tests using `npm test` to make sure everything is working correctly. See below for details on running integration tests.
7. Commit your changes and push them to your forked repository. Use [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) format for the commit message. See the note below.
8. Submit a pull request to the main repository.
9. When your PR is merged into the `alpha` branch, an alpha package is published to NPM.
10. When the `alpha` branch is merged into `main`, a new package is published to NPM.

## A note on commit messages

The repository uses []`semantic-release`](https://github.com/semantic-release/semantic-release) to create releases. Because we track the Camunda 8 Platform minor version, we need to treat feature implementation during a minor release cycle as a `fix` rather than a `feature`.

Creating a commit with a `feature` commit message will cause the package version minor release number to increment, which we only do when Camunda 8 Platform releases a new minor version.

## Running tests

Run all the unit tests with `lerna run test`.
Run all the unit tests with `npm run test`.

### Integration tests

Integration tests can be run against Self-Managed or against Camunda SaaS.

To run integration tests against Camunda SaaS, but credentials for a Camunda SaaS API Client with scopes for all components in the environment, then run the integration tests against Camunda SaaS with `lerna run test:integration`.
To run integration tests against Camunda SaaS, but credentials for a Camunda SaaS API Client with scopes for all components in the environment, then run the integration tests against Camunda SaaS with `npm run test:integration`.

To run the integration tests against Self-Managed, you can use either your own Self-Managed instance, or start one locally using Docker.

Expand Down Expand Up @@ -79,6 +88,8 @@ export CAMUNDA_TEST_TYPE='local'
export CAMUNDA_TENANT_ID='<default>'
```

Now run the integration tests against Self-Managed with `npm run test:multitenancy`.

## Code Style

We follow a specific code style in our project to maintain consistency. Please make sure to adhere to the following guidelines:
Expand All @@ -88,18 +99,18 @@ We follow a specific code style in our project to maintain consistency. Please m

## Issue Reporting

If you encounter any bugs or issues while using @camunda/sdk, please report them in the [issue tracker](https://github.com/camunda-community-hub/camunda-8-js-sdk/issues). Provide as much detail as possible, including steps to reproduce the issue.
If you encounter any bugs or issues while using @camunda/sdk, please report them in the [issue tracker](https://github.com/camunda/camunda-8-js-sdk/issues). Provide as much detail as possible, including steps to reproduce the issue.

## Feature Requests

If you have any ideas or feature requests for @camunda/sdk, please submit them in the [issue tracker](https://github.com/camunda-community-hub/camunda-8-js-sdk/issues). We appreciate your feedback and suggestions.
If you have any ideas or feature requests for @camunda/sdk, please submit them in the [issue tracker](https://github.com/camunda/camunda-8-js-sdk/issues). We appreciate your feedback and suggestions.

## License

By contributing to @camunda/sdk, you agree that your contributions will be licensed under the [Apache License](https://opensource.org/licenses/Apache).

## Contact

If you have any questions or need further assistance, feel free to reach out to us at [your-email@example.com].
If you have any questions or need further assistance, open an issue in the repository.

Happy contributing!
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![NPM](https://nodei.co/npm/@camunda8/sdk.png)](https://www.npmjs.com/package/@camunda8/sdk)

This is the official Camunda 8 JavaScript SDK. It is written in TypeScript and runs on Node.js. See details on why [this is not in a web browser](https://github.com/camunda-community-hub/camunda-8-js-sdk/issues/79)).
This is the official Camunda 8 JavaScript SDK. It is written in TypeScript and runs on Node.js. See details on why [this is not in a web browser](https://github.com/camunda/camunda-8-js-sdk/issues/79)).

## Using the SDK in your project

Expand Down Expand Up @@ -38,7 +38,7 @@ The configuration object fields and the environment variables have exactly the s

## A note on how int64 is handled in the JavaScript SDK

Entity keys in Camunda 8 are stored and represented as `int64` numbers. The range of `int64` extends to numbers that cannot be represented by the JavaScript `number` type. To deal with this, `int64` keys are serialised by the SDK to the JavaScript `string` type. See [this issue](https://github.com/camunda-community-hub/camunda-8-js-sdk/issues/78) for more details.
Entity keys in Camunda 8 are stored and represented as `int64` numbers. The range of `int64` extends to numbers that cannot be represented by the JavaScript `number` type. To deal with this, `int64` keys are serialised by the SDK to the JavaScript `string` type. See [this issue](https://github.com/camunda/camunda-8-js-sdk/issues/78) for more details.

Some number values - for example: "_total returned results_ " - may be specified as `int64` in the API specifications. Although these numbers will usually not contain unsafe values, they are always serialised to `string`.

Expand Down Expand Up @@ -184,7 +184,7 @@ The SDK uses the [`debug`](https://github.com/debug-js/debug) library. To enable

| Value | Component |
| ---------------------- | -------------------- |
| `camunda:adminconsole` | Administration API |
| `camunda:adminconsole` | Administration API |
| `camunda:modeler` | Modeler API |
| `camunda:operate` | Operate API |
| `camunda:optimize` | Optimize API |
Expand Down
17 changes: 0 additions & 17 deletions lerna.json

This file was deleted.

55 changes: 55 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading