Skip to content

Commit 03d6e0a

Browse files
committed
added release workflow
1 parent dce7c8f commit 03d6e0a

File tree

5 files changed

+66
-6
lines changed

5 files changed

+66
-6
lines changed

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build:
8+
name: Build and upload
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: "16.x"
19+
- name: Installing dependencies
20+
run: npm install
21+
- name: Build
22+
run: npm run prepack
23+
- name: Upload dist
24+
uses: actions/upload-artifact@v3
25+
with:
26+
name: lib
27+
path: lib
28+
29+
release:
30+
name: Download dist and release
31+
runs-on: ubuntu-latest
32+
needs: build
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 0
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v1
40+
with:
41+
node-version: "16.x"
42+
- name: Installing dependencies
43+
run: npm install
44+
- name: Download dist
45+
uses: actions/download-artifact@v3
46+
with:
47+
name: lib
48+
path: lib
49+
- name: Display dirs
50+
run: ls -R
51+
- name: Release
52+
uses: JS-DevTools/npm-publish@v1
53+
with:
54+
token: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ DESCRIPTION
224224
List all Content Types in a Stack
225225
226226
EXAMPLES
227-
$ csdx content-type:list -s "xxxxxxxxxxxxxxxxxxx"
227+
$ csdx content-type:list -k "xxxxxxxxxxxxxxxxxxx"
228228
229229
$ csdx content-type:list -a "management token"
230230

src/commands/content-type/audit.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Command from '../../core/command'
22
import { flags, FlagInput, managementSDKClient, cliux, printFlagDeprecation } from '@contentstack/cli-utilities'
33
import buildOutput from '../../core/content-type/audit'
4-
import { getStack, getUsers } from '../../utils'
4+
import { getStack, getUsers, getContentType } from '../../utils'
55

66
export default class AuditCommand extends Command {
77
static description = 'Display recent changes to a Content Type'
@@ -52,13 +52,18 @@ export default class AuditCommand extends Command {
5252
})
5353

5454
const spinner = cliux.loaderV2(Command.RequestDataMessage)
55-
55+
//validate content type
56+
await getContentType({
57+
managementSdk: this.contentTypeManagementClient,
58+
apiKey: this.apiKey,
59+
uid: flags['content-type'],
60+
spinner
61+
});
5662
const [stack, audit, users] = await Promise.all([
5763
getStack(this.contentTypeManagementClient, this.apiKey, spinner),
5864
this.client.getContentTypeAuditLogs(this.apiKey, flags['content-type'], spinner),
5965
getUsers(this.contentTypeManagementClient, this.apiKey, spinner)
6066
])
61-
6267
cliux.loaderV2('', spinner)
6368

6469
const output = buildOutput(audit.logs, users)

src/commands/content-type/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default class ListCommand extends Command {
77
static description = 'List all Content Types in a Stack'
88

99
static examples = [
10-
'$ csdx content-type:list -s "xxxxxxxxxxxxxxxxxxx"',
10+
'$ csdx content-type:list -k "xxxxxxxxxxxxxxxxxxx"',
1111
'$ csdx content-type:list -a "management token"',
1212
'$ csdx content-type:list -a "management token" -o modified'
1313
]

src/core/command.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ export default class ContentTypeCommand extends Command {
4040

4141
this.apiKey = token.apiKey
4242
} else {
43-
this.apiKey = flags.stackAPIKey as string
43+
this.apiKey = stackAPIKey as string
4444
}
4545

4646
this.client = new ContentstackClient(this.cmaHost, authToken)
4747
}
4848

4949
printOutput(output: BuildOutput, who: string, what: string | null, where: string) {
5050
this.log(`Requested ${who}${what ? ` for '${what}' ` : ' '}on '${where}.'`)
51+
this.log('------\n')
5152

5253
if (output.hasResults) {
5354
if (output.header) {

0 commit comments

Comments
 (0)