Skip to content

Commit

Permalink
fix: update docs (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpascal authored Sep 20, 2024
1 parent 12aba73 commit 55f3b21
Show file tree
Hide file tree
Showing 7 changed files with 8,141 additions and 2,141 deletions.
96 changes: 11 additions & 85 deletions .github/workflows/release_package.yml
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
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
22 changes: 22 additions & 0 deletions .releaserc.json
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]"
}
]
]
}
67 changes: 37 additions & 30 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
=======
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
Loading

0 comments on commit 55f3b21

Please sign in to comment.