-
Notifications
You must be signed in to change notification settings - Fork 7
feat(release): support distribution tags and custom release user info #292
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
Changes from all commits
4ce3fe4
5af82ec
c17e46b
e930a11
08f7cb5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: 'dhis2-node lint' | ||
|
|
||
| on: push | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
| steps: | ||
| - uses: actions/checkout@v1 | ||
| - uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: 12.x | ||
|
|
||
| - name: Install | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Run linters | ||
| run: | | ||
| npx d2-style js check | ||
| npx d2-style text check | ||
| env: | ||
| CI: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: 'dhis2-node publish' | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| # match branches in: | ||
| # https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#branches | ||
| - master | ||
| - next | ||
| - next-major | ||
| - alpha | ||
| - beta | ||
| - '[0-9]+.x' | ||
| - '[0-9]+.x.x' | ||
| - '[0-9]+.[0-9]+.x' | ||
|
|
||
| env: | ||
| GIT_AUTHOR_NAME: '@dhis2-bot' | ||
| GIT_AUTHOR_EMAIL: 'apps@dhis2.org' | ||
| GIT_COMMITTER_NAME: '@dhis2-bot' | ||
| GIT_COMMITTER_EMAIL: 'apps@dhis2.org' | ||
| NPM_TOKEN: ${{secrets.NPM_TOKEN}} | ||
| GH_TOKEN: ${{secrets.GH_TOKEN}} | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
| steps: | ||
| - uses: actions/checkout@v1 | ||
| - uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: 12.x | ||
|
|
||
| - name: Install | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Smoke | ||
| run: ./packages/main/bin/d2 debug system | ||
|
|
||
| - name: Test | ||
| run: yarn test | ||
|
|
||
| - name: Publish to NPM | ||
| run: npx @dhis2/cli-utils release --publish npm | ||
| env: | ||
| CI: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: 'dhis2-node test' | ||
|
|
||
| on: push | ||
|
|
||
| jobs: | ||
| unit: | ||
| runs-on: ubuntu-latest | ||
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
| steps: | ||
| - uses: actions/checkout@v1 | ||
| - uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: 12.x | ||
|
|
||
| - name: Install | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Test | ||
| run: yarn test | ||
| env: | ||
| CI: true |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Introduction | ||
|
|
||
| `d2 utils release` allows you to publish libraries and applications to | ||
| various package repositories. | ||
|
|
||
| # Usage | ||
|
|
||
| Internally the `release` command utilizes [semantic | ||
| release](https://github.com/semantic-release/semantic-release), so | ||
| understanding how that tool operates is helpful. | ||
|
|
||
| Simply put, every time a commit appears on the `master` branch, the | ||
| fully automated release process begins, and the commit is released. | ||
|
|
||
| # Advanced usage | ||
|
|
||
| ## Distribution channels | ||
|
|
||
| We support the default channels recommended by semantic release, and | ||
| there is a [good | ||
| walkthrough](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/distribution-channels.md) | ||
| of them available on their docs. | ||
|
|
||
| Our [GH Actions | ||
| workflow](https://github.com/dhis2/workflows/blob/master/ci/node-publish.yml#L5) | ||
| is kept in sync with those defaults. | ||
|
|
||
| It is possible to e.g. only use the `master` branch for releases by | ||
| restricting the `on.push.branches` list in the workflow file in the | ||
| local repo. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,15 @@ | ||
| # fo | ||
| # Install the CLI | ||
|
|
||
| ``` | ||
| yarn global add @dhis2/cli | ||
|
|
||
| # or | ||
|
|
||
| npm install --global @dhis2/cli | ||
| ``` | ||
|
|
||
| # Verify that it is available on PATH | ||
|
|
||
| ``` | ||
| d2 --version | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,7 +36,7 @@ const createNewTranslationFiles = ({ | |
| appendToExistingFiles, | ||
| }) => { | ||
| for (const language in translations) { | ||
| if (translations.hasOwnProperty(language)) { | ||
| if (Object.prototype.hasOwnProperty.call(translations, language)) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: no access to prototype built-ins |
||
| if ( | ||
| languagesToTransform.length && | ||
| languagesToTransform.indexOf(language) === -1 | ||
|
|
@@ -88,7 +88,12 @@ const createNewTranslationFiles = ({ | |
| } | ||
|
|
||
| for (const key in languageTranslations) { | ||
| if (languageTranslations.hasOwnProperty(key)) { | ||
| if ( | ||
| Object.prototype.hasOwnProperty.call( | ||
| languageTranslations, | ||
| key | ||
| ) | ||
| ) { | ||
| if (!translations[primaryLanguage][key]) { | ||
| logMissingKeys && | ||
| reporter.info( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| const fs = require('fs') | ||
|
|
||
| const { reporter } = require('@dhis2/cli-helpers-engine') | ||
|
|
||
| /** | ||
|
|
@@ -16,7 +17,7 @@ const deleteLegacyFiles = ({ translationFiles, languagesToTransform }) => { | |
| languagesToTransform.indexOf(language) !== -1 | ||
| ) { | ||
| try { | ||
| const filePathToDelete = path.join(inDir, file) | ||
| const filePathToDelete = file | ||
|
Comment on lines
-19
to
+20
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: no undefined variables |
||
| fs.unlinkSync(filePathToDelete) | ||
| reporter.debug(`Deleted old file:`) | ||
| reporter.debug(`"${filePathToDelete}"`) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ const run = async function(argv) { | |
| process.exit(1) | ||
| } | ||
|
|
||
| const rest = await tryCatchAsync( | ||
| const res = await tryCatchAsync( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: no unused variables Also a bug where |
||
| 'db::restore', | ||
| restore({ | ||
| cacheLocation, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,21 +51,17 @@ const run = async function(argv) { | |
| await Promise.all( | ||
| clusters.map(async cluster => { | ||
| const status = await getStatus(cluster) | ||
| cluster.status = formatStatus(status) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: possible race condition (mutating source while looping) |
||
| table.push([ | ||
| chalk.blue(cluster.name), | ||
| cluster.port, | ||
| cluster.channel, | ||
| cluster.dhis2Version, | ||
| cluster.dbVersion, | ||
| formatStatus(status), | ||
| ]) | ||
| }) | ||
| ) | ||
|
|
||
| clusters.forEach(cluster => | ||
| table.push([ | ||
| chalk.blue(cluster.name), | ||
| cluster.port, | ||
| cluster.channel, | ||
| cluster.dhis2Version, | ||
| cluster.dbVersion, | ||
| cluster.status, | ||
| ]) | ||
| ) | ||
|
|
||
| reporter.print(table) | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ const downloadDatabase = async ({ cache, dbVersion, update, url }) => { | |
| } | ||
| } | ||
|
|
||
| const restoreFromFile = async ({ cacheLocation, dbFile, dbVersion, name }) => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: no unused variables |
||
| const restoreFromFile = async ({ cacheLocation, dbFile, name }) => { | ||
| reporter.info(`Restoring database (this may take some time)...`) | ||
| reporter.debug(`Restoring from database dump ${chalk.bold(dbFile)}`) | ||
|
|
||
|
|
@@ -63,5 +63,5 @@ module.exports = async ({ | |
| update, | ||
| }) | ||
|
|
||
| await restoreFromFile({ cacheLocation, dbFile, dbVersion, name }) | ||
| await restoreFromFile({ cacheLocation, dbFile, name }) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| const { reporter, chalk } = require('@dhis2/cli-helpers-engine') | ||
|
|
||
| const buildApp = async ({ name, ...argv }) => { | ||
| const buildApp = async () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: no unused variables |
||
| reporter.info( | ||
| `Hold your horses! DHIS2 application bootstrapping with ${chalk.bold( | ||
| 'd2 create app' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ const handler = async ({ type, name, ...argv }) => { | |
| } | ||
| type = type.toLowerCase() | ||
| switch (type) { | ||
| case 'cli': | ||
| case 'cli': { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: lexical scope needed to use |
||
| reporter.info(`Creating CLI module in ${name}...`) | ||
| const data = await cliBuilder({ name, ...argv }) | ||
| const dest = path.join(process.cwd(), data.basename) | ||
|
|
@@ -23,8 +23,8 @@ const handler = async ({ type, name, ...argv }) => { | |
| reporter.debug(' dest:', dest) | ||
| reporter.debug(' data: ', data) | ||
| await installTemplate(src, dest, data) | ||
|
|
||
| break | ||
| } | ||
| case 'app': | ||
| await require('./builders/app')({ name, ...argv }) | ||
| break | ||
|
|
@@ -35,17 +35,6 @@ const handler = async ({ type, name, ...argv }) => { | |
| const command = { | ||
| command: 'create <type> [name]', | ||
| desc: 'Create various DHIS2 components from templates', | ||
| builder: yargs => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: no unused variables |
||
| // yargs.positional('type', { | ||
| // describe: 'The type of thing to create', | ||
| // choices: ['cli', 'app'], | ||
| // type: 'string' | ||
| // }); | ||
| // yargs.positional('name', { | ||
| // describe: 'The name of the directory in which to create the thing', | ||
| // type: 'string' | ||
| // }); | ||
| }, | ||
| handler, | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| const run = ({ _, $0, raw, ...argv }) => { | ||
| const run = ({ raw, ...argv }) => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint rule: no unused variables |
||
| const out = JSON.stringify(argv, undefined, raw ? undefined : 2) | ||
| console.log(out) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint rule: no unused