-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12aba73
commit 55f3b21
Showing
7 changed files
with
8,141 additions
and
2,141 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 |
---|---|---|
@@ -1,99 +1,25 @@ | ||
name: Release package | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-type: | ||
description: 'Release type (one of): patch, minor, major, prepatch, preminor, premajor, prerelease' | ||
required: true | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Checkout project repository | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# Setup Node.js environment | ||
with: | ||
persist-credentials: false | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
registry-url: https://registry.npmjs.org/ | ||
node-version: '18' | ||
|
||
# Install dependencies (required by Run tests step) | ||
node-version: '20.x' | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
# Configure Git | ||
- name: Git configuration | ||
run: | | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "GitHub Actions" | ||
# Bump package version | ||
# Use tag latest | ||
- name: Bump release version | ||
if: startsWith(github.event.inputs.release-type, 'pre') != true | ||
run: | | ||
echo "NEW_VERSION=$(npm --no-git-tag-version version $RELEASE_TYPE)" >> $GITHUB_ENV | ||
echo "RELEASE_TAG=latest" >> $GITHUB_ENV | ||
env: | ||
RELEASE_TYPE: ${{ github.event.inputs.release-type }} | ||
|
||
# Bump package pre-release version | ||
# Use tag beta for pre-release versions | ||
- name: Bump pre-release version | ||
if: startsWith(github.event.inputs.release-type, 'pre') | ||
run: | | ||
echo "NEW_VERSION=$(npm --no-git-tag-version --preid=beta version $RELEASE_TYPE | ||
echo "RELEASE_TAG=beta" >> $GITHUB_ENV | ||
env: | ||
RELEASE_TYPE: ${{ github.event.inputs.release-type }} | ||
|
||
# Update changelog unreleased section with new version | ||
- name: Update changelog | ||
uses: superfaceai/release-changelog-action@v1 | ||
with: | ||
path-to-changelog: CHANGELOG.md | ||
version: ${{ env.NEW_VERSION }} | ||
operation: release | ||
|
||
# Commit changes | ||
- name: Commit CHANGELOG.md and package.json changes and create tag | ||
run: | | ||
git add "package.json" | ||
git add "CHANGELOG.md" | ||
git commit -m "chore: release ${{ env.NEW_VERSION }}" | ||
git tag ${{ env.NEW_VERSION }} | ||
# Publish version to public repository | ||
- name: Publish | ||
run: npm publish --verbose --access public --tag ${{ env.RELEASE_TAG }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
# Push repository changes | ||
- name: Push changes to repository | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} | ||
run: | | ||
git push origin && git push --tags | ||
# Read version changelog | ||
- id: get-changelog | ||
name: Get version changelog | ||
uses: superfaceai/release-changelog-action@v1 | ||
with: | ||
path-to-changelog: CHANGELOG.md | ||
version: ${{ env.NEW_VERSION }} | ||
operation: read | ||
|
||
# Update GitHub release with changelog | ||
- name: Update GitHub release documentation | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ env.NEW_VERSION }} | ||
body: ${{ steps.get-changelog.outputs.changelog }} | ||
prerelease: ${{ startsWith(github.event.inputs.release-type, 'pre') }} | ||
run: npm ci --legacy-peer-deps | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release |
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 @@ | ||
npx --no-install commitlint --edit "$1" |
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,22 @@ | ||
{ | ||
"branches": ["master"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
[ | ||
"@semantic-release/changelog", | ||
{ | ||
"changelogFile": "CHANGELOG.md" | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]" | ||
} | ||
] | ||
] | ||
} |
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 |
---|---|---|
|
@@ -105,36 +105,6 @@ npx cht-stock-monitoring-workflow add feature | |
> [!NOTE] | ||
> For more details about available features please check features documentation here: [docs/features](docs/features) | ||
## Stock Logs | ||
|
||
Create a stock form for level 3 | ||
|
||
### Questions parameters | ||
|
||
| Name | Type | Description | Required | | ||
| --------------- | ---------- | --------------------------- | -------- | | ||
| `form_name` | `string` | The stock logs form name/ID | true | | ||
| `title[lang]` | `string` | The stock logs form title | true | | ||
|
||
# Development | ||
|
||
### Commit format | ||
The commit format should follow this [conventional-changelog angular preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular). | ||
|
||
# Copyright | ||
|
||
Copyright 2013-2024 Medic Mobile, Inc. <[email protected]> | ||
|
||
# License | ||
|
||
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license. | ||
======= | ||
|
||
| Name | Type | Description | Required | | ||
| --------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | | ||
| `form_name` | `string` | The stock out form name/ID | true | | ||
| `title[lang]` | `string` | The stock order form title | true | | ||
| `formular` | `item_danger_qty` or `weekly_qty` | if weekly_qty, there is low stock if stock count < 2 * estimated weekly consumption. Else, there is low stock if stock count < item.danger_total | true | | ||
|
||
# Task configuration | ||
|
||
|
@@ -189,3 +159,40 @@ To include stock monitoring configurations in the `contact-summary.template.js` | |
```shell | ||
npx cht-stock-monitoring-workflow build | ||
``` | ||
|
||
# Development | ||
|
||
## Commit format | ||
The commit format should follow this [conventional-changelog angular preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular). Examples are provided below. | ||
|
||
Type | Example commit message | Release type | ||
-- | -- | -- | ||
Bug fixes | fix(#123): infinite loop when materialized views doesn't exist | patch | ||
Performance | perf(#789): Refresh materialized views faster | patch | ||
Features | feat(#456): Support real-time sync | minor | ||
Non-code | chore(#123): update README | none | ||
Breaking| perf(#2): remove support for pg 7 <br/> BREAKING CHANGE: postgres 7 no longer supported | major | ||
|
||
## Releasing | ||
1. Create a pull request with prep for the new release (see [above](#submitting-code)). | ||
2. Get the pull request reviewed and approved. | ||
3. When doing the squash and merge, make sure that your commit message is clear and readable and follows the strict format described in the commit format section [bellow](#commit-format). If the commit message does not comply, automatic release will fail. | ||
4. In case you are planning to merge the pull request with a merge commit, make sure that every commit in your branch respects the [format](#commit-format). | ||
|
||
## Releasing betas | ||
|
||
1. Checkout the default branch, for example `main` | ||
1. Run `npm version --no-git-tag-version <major>.<minor>.<patch>-beta.1`. This will only update the versions in `package.json` and `package-lock.json`. It will not create a git tag and not create an associated commit. | ||
1. Run `npm publish --tag beta`. This will publish your beta tag to npm's beta channel. | ||
|
||
To install from the beta channel, run `npm install @medic/cht-stock-monitoring-workflow@beta`. | ||
|
||
|
||
# Copyright | ||
|
||
Copyright 2013-2024 Medic Mobile, Inc. <[email protected]> | ||
|
||
# License | ||
|
||
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license. | ||
======= |
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 @@ | ||
module.exports = { extends: ['@commitlint/config-conventional'] }; |
Oops, something went wrong.