@rockcarver/frodo-lib 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +32 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/README.md +121 -0
- package/.github/workflows/pipeline.yml +287 -0
- package/.prettierrc +6 -0
- package/CHANGELOG.md +512 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/LICENSE +21 -0
- package/README.md +8 -0
- package/docs/CONTRIBUTE.md +96 -0
- package/docs/PIPELINE.md +169 -0
- package/docs/images/npm_versioning_guidelines.png +0 -0
- package/docs/images/release_pipeline.png +0 -0
- package/jsconfig.json +6 -0
- package/package.json +95 -0
- package/resources/sampleEntitiesFile.json +8 -0
- package/resources/sampleEnvFile.env +2 -0
- package/src/api/AuthenticateApi.js +33 -0
- package/src/api/BaseApi.js +242 -0
- package/src/api/CirclesOfTrustApi.js +87 -0
- package/src/api/EmailTemplateApi.js +37 -0
- package/src/api/IdmConfigApi.js +88 -0
- package/src/api/LogApi.js +45 -0
- package/src/api/ManagedObjectApi.js +62 -0
- package/src/api/OAuth2ClientApi.js +69 -0
- package/src/api/OAuth2OIDCApi.js +73 -0
- package/src/api/OAuth2ProviderApi.js +32 -0
- package/src/api/RealmApi.js +99 -0
- package/src/api/Saml2Api.js +176 -0
- package/src/api/ScriptApi.js +84 -0
- package/src/api/SecretsApi.js +151 -0
- package/src/api/ServerInfoApi.js +41 -0
- package/src/api/SocialIdentityProvidersApi.js +114 -0
- package/src/api/StartupApi.js +45 -0
- package/src/api/ThemeApi.js +181 -0
- package/src/api/TreeApi.js +207 -0
- package/src/api/VariablesApi.js +104 -0
- package/src/api/utils/ApiUtils.js +77 -0
- package/src/api/utils/ApiUtils.test.js +96 -0
- package/src/api/utils/Base64.js +62 -0
- package/src/index.js +32 -0
- package/src/index.test.js +13 -0
- package/src/ops/AdminOps.js +901 -0
- package/src/ops/AuthenticateOps.js +342 -0
- package/src/ops/CirclesOfTrustOps.js +350 -0
- package/src/ops/ConnectionProfileOps.js +254 -0
- package/src/ops/EmailTemplateOps.js +326 -0
- package/src/ops/IdmOps.js +227 -0
- package/src/ops/IdpOps.js +342 -0
- package/src/ops/JourneyOps.js +2026 -0
- package/src/ops/LogOps.js +357 -0
- package/src/ops/ManagedObjectOps.js +34 -0
- package/src/ops/OAuth2ClientOps.js +151 -0
- package/src/ops/OrganizationOps.js +85 -0
- package/src/ops/RealmOps.js +139 -0
- package/src/ops/SamlOps.js +541 -0
- package/src/ops/ScriptOps.js +211 -0
- package/src/ops/SecretsOps.js +288 -0
- package/src/ops/StartupOps.js +114 -0
- package/src/ops/ThemeOps.js +379 -0
- package/src/ops/VariablesOps.js +185 -0
- package/src/ops/templates/OAuth2ClientTemplate.json +270 -0
- package/src/ops/templates/OrgModelUserAttributesTemplate.json +149 -0
- package/src/ops/templates/cloud/GenericExtensionAttributesTemplate.json +392 -0
- package/src/ops/templates/cloud/managed.json +4119 -0
- package/src/ops/utils/Console.js +434 -0
- package/src/ops/utils/DataProtection.js +92 -0
- package/src/ops/utils/DataProtection.test.js +28 -0
- package/src/ops/utils/ExportImportUtils.js +146 -0
- package/src/ops/utils/ExportImportUtils.test.js +119 -0
- package/src/ops/utils/OpsUtils.js +76 -0
- package/src/ops/utils/Wordwrap.js +11 -0
- package/src/storage/SessionStorage.js +45 -0
- package/src/storage/StaticStorage.js +15 -0
- package/test/e2e/journey/baseline/ForgottenUsername.journey.json +216 -0
- package/test/e2e/journey/baseline/Login.journey.json +205 -0
- package/test/e2e/journey/baseline/PasswordGrant.journey.json +139 -0
- package/test/e2e/journey/baseline/ProgressiveProfile.journey.json +198 -0
- package/test/e2e/journey/baseline/Registration.journey.json +249 -0
- package/test/e2e/journey/baseline/ResetPassword.journey.json +268 -0
- package/test/e2e/journey/baseline/UpdatePassword.journey.json +323 -0
- package/test/e2e/journey/baseline/allAlphaJourneys.journeys.json +1520 -0
- package/test/e2e/journey/delete/ForgottenUsername.journey.json +216 -0
- package/test/e2e/journey/delete/Login.journey.json +205 -0
- package/test/e2e/journey/delete/PasswordGrant.journey.json +139 -0
- package/test/e2e/journey/delete/ProgressiveProfile.journey.json +198 -0
- package/test/e2e/journey/delete/Registration.journey.json +249 -0
- package/test/e2e/journey/delete/ResetPassword.journey.json +268 -0
- package/test/e2e/journey/delete/UpdatePassword.journey.json +323 -0
- package/test/e2e/journey/delete/deleteMe.journey.json +230 -0
- package/test/e2e/journey/list/Disabled.journey.json +43 -0
- package/test/e2e/journey/list/ForgottenUsername.journey.json +216 -0
- package/test/e2e/journey/list/Login.journey.json +205 -0
- package/test/e2e/journey/list/PasswordGrant.journey.json +139 -0
- package/test/e2e/journey/list/ProgressiveProfile.journey.json +198 -0
- package/test/e2e/journey/list/Registration.journey.json +249 -0
- package/test/e2e/journey/list/ResetPassword.journey.json +268 -0
- package/test/e2e/journey/list/UpdatePassword.journey.json +323 -0
- package/test/e2e/setup.js +107 -0
- package/test/e2e/theme/baseline/Contrast.theme.json +95 -0
- package/test/e2e/theme/baseline/Highlander.theme.json +95 -0
- package/test/e2e/theme/baseline/Robroy.theme.json +95 -0
- package/test/e2e/theme/baseline/Starter-Theme.theme.json +94 -0
- package/test/e2e/theme/baseline/Zardoz.theme.json +95 -0
- package/test/e2e/theme/import/Contrast.theme.json +95 -0
- package/test/e2e/theme/import/Highlander.theme.json +95 -0
- package/test/e2e/theme/import/Robroy.theme.json +95 -0
- package/test/e2e/theme/import/Starter-Theme.theme.json +94 -0
- package/test/e2e/theme/import/Zardoz.default.theme.json +95 -0
- package/test/fs_tmp/.gitkeep +2 -0
- package/test/global/setup.js +65 -0
package/.eslintrc
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["airbnb", "prettier"],
|
|
3
|
+
"parser": "@babel/eslint-parser",
|
|
4
|
+
"parserOptions": {
|
|
5
|
+
"requireConfigFile": false
|
|
6
|
+
},
|
|
7
|
+
"plugins": ["prettier", "jest"],
|
|
8
|
+
"rules": {
|
|
9
|
+
"prettier/prettier": ["error"],
|
|
10
|
+
"import/extensions": [
|
|
11
|
+
"error",
|
|
12
|
+
{
|
|
13
|
+
"js": "always",
|
|
14
|
+
"json": "always"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"no-console": "off",
|
|
18
|
+
"no-underscore-dangle": "off",
|
|
19
|
+
"no-restricted-syntax": [
|
|
20
|
+
"error",
|
|
21
|
+
// "ForInStatement",
|
|
22
|
+
// "ForOfStatement",
|
|
23
|
+
"LabeledStatement",
|
|
24
|
+
"WithStatement"
|
|
25
|
+
],
|
|
26
|
+
"no-multi-str": "off"
|
|
27
|
+
},
|
|
28
|
+
"env": {
|
|
29
|
+
"jest": true,
|
|
30
|
+
"jest/globals": true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Run command with parameters '...'
|
|
16
|
+
2. See error
|
|
17
|
+
|
|
18
|
+
**Expected behavior**
|
|
19
|
+
A clear and concise description of what you expected to happen.
|
|
20
|
+
|
|
21
|
+
**Screenshots**
|
|
22
|
+
If applicable, add screenshots/command output to help explain your problem.
|
|
23
|
+
|
|
24
|
+
**Desktop (please complete the following information):**
|
|
25
|
+
- OS: [e.g. iOS]
|
|
26
|
+
- Browser [e.g. chrome, safari]
|
|
27
|
+
- Version [e.g. 22]
|
|
28
|
+
|
|
29
|
+
**Additional context**
|
|
30
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for frodo
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<!-- README.md for GitHub; the one for NPM is ../README.md. -->
|
|
2
|
+
# Frodo Library - @rockcarver/frodo-lib
|
|
3
|
+
|
|
4
|
+
ForgeROck DO library, frodo-lib, a library to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.
|
|
5
|
+
|
|
6
|
+
Frodo-lib powers [frodo-cli](https://github.com/rockcarver/frodo-cli), the command line tool to manage ForgeRock deployments.
|
|
7
|
+
|
|
8
|
+
## Quick Nav
|
|
9
|
+
|
|
10
|
+
- [Features](#features)
|
|
11
|
+
- [Limitations](#limitations)
|
|
12
|
+
- [Installing](#installing)
|
|
13
|
+
- [Request features or report issues](#feature-requests)
|
|
14
|
+
- [Contributing](#contributing)
|
|
15
|
+
- [Maintaining](#maintaining)
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
Frodo allows an administrator to easily connect to and manage any number of Identity Cloud tenants, ForgeOps deployment instances, or classic deployment instances from the command line. The following tasks are currently supported:
|
|
20
|
+
|
|
21
|
+
- User mode
|
|
22
|
+
|
|
23
|
+
Install and run pre-compiled single binaries without any dependencies for MacOS, Windows, and Linux.
|
|
24
|
+
|
|
25
|
+
- Manage journeys/trees.
|
|
26
|
+
|
|
27
|
+
Export, import and pruning of journeys. Frodo handles referenced scripts and email templates.
|
|
28
|
+
|
|
29
|
+
- Manage applications.
|
|
30
|
+
|
|
31
|
+
List, export, and import applications (OAuth2 clients).
|
|
32
|
+
|
|
33
|
+
- Manage connection profiles.
|
|
34
|
+
|
|
35
|
+
Saving and reading credentials (for multiple ForgeRock deployments) from a configuration file.
|
|
36
|
+
|
|
37
|
+
- Manage email templates.
|
|
38
|
+
|
|
39
|
+
List, export, and import email templates.
|
|
40
|
+
|
|
41
|
+
- Manage IDM configuration.
|
|
42
|
+
|
|
43
|
+
Export of IDM configuration. Import is coming.
|
|
44
|
+
|
|
45
|
+
- Print versions and tokens.
|
|
46
|
+
|
|
47
|
+
Obtain ForgeRock session token and admin access_tokens for a ForgeRock Identity Cloud or platform (ForgeOps) deployment
|
|
48
|
+
|
|
49
|
+
- View Identity Cloud logs.
|
|
50
|
+
|
|
51
|
+
List available log sources and tail them.
|
|
52
|
+
|
|
53
|
+
- Manage realms.
|
|
54
|
+
|
|
55
|
+
List realms and show realm details. Allow adding and removing of custom DNS names.
|
|
56
|
+
|
|
57
|
+
- Manage scripts.
|
|
58
|
+
|
|
59
|
+
List, export, and import scripts.
|
|
60
|
+
|
|
61
|
+
- Manage Identity Cloud environment specific variables and secrets.
|
|
62
|
+
|
|
63
|
+
List and view details of secrets and variables in Identity Cloud.
|
|
64
|
+
|
|
65
|
+
- Platform admin tasks.
|
|
66
|
+
|
|
67
|
+
Common tasks administrators need to perform daily that are tedious and repetitive. Advanced tasks, which used to be involved and potentially dangerous if performed manually, now made easy and safe.
|
|
68
|
+
|
|
69
|
+
- Create an oauth2 client with admin privileges.
|
|
70
|
+
- Get an access token using client credentials grant type.
|
|
71
|
+
- List oauth2 clients with admin privileges.
|
|
72
|
+
- Grant an oauth2 client admin privileges.
|
|
73
|
+
- Revoke admin privileges from an oauth2 client.
|
|
74
|
+
- List oauth2 clients with custom privileges.
|
|
75
|
+
- List all subjects of static user mappings that are not oauth2 clients.
|
|
76
|
+
- Remove a subject's static user mapping.
|
|
77
|
+
- Add AutoId static user mapping to enable dashboards and other AutoId-based functionality.
|
|
78
|
+
- Hide generic extension attributes.
|
|
79
|
+
- Show generic extension attributes.
|
|
80
|
+
- Repair org model (beta).
|
|
81
|
+
|
|
82
|
+
## Limitations
|
|
83
|
+
|
|
84
|
+
`frodo` can't export passwords (including API secrets, etc), so these need to be manually added back to imported configuration or alternatively, edit the export file to add the missing fields before importing.
|
|
85
|
+
|
|
86
|
+
## Installing
|
|
87
|
+
|
|
88
|
+
### Developer Mode
|
|
89
|
+
For those who want to contribute or are just curious about the build process.
|
|
90
|
+
|
|
91
|
+
- Make sure you have Node.js v18 (the version used by developers) or newer and npm.
|
|
92
|
+
- Clone this repo
|
|
93
|
+
```console
|
|
94
|
+
git clone https://github.com/rockcarver/frodo-lib.git
|
|
95
|
+
```
|
|
96
|
+
- Install dependencies via NPM
|
|
97
|
+
```console
|
|
98
|
+
cd frodo-lib
|
|
99
|
+
npm ci
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### NPM package
|
|
103
|
+
If you are a node developer and want to use frodo-lib as a library for your own applications, you can install the npm package:
|
|
104
|
+
|
|
105
|
+
- To install the latest version as a dependency for you own application:
|
|
106
|
+
```console
|
|
107
|
+
npm i --save @rockcarver/frodo-lib
|
|
108
|
+
```
|
|
109
|
+
- To install the latest pre-release:
|
|
110
|
+
```console
|
|
111
|
+
npm i @rockcarver/frodo-lib@next
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Feature requests
|
|
115
|
+
Please use the repository's [issues](https://github.com/rockcarver/frodo-lib/issues) to request new features/enhancements or report bugs/issues.
|
|
116
|
+
|
|
117
|
+
## Contributing
|
|
118
|
+
If you would like to contribute to frodo, please refer to the [contributing instructions](../docs/CONTRIBUTE.md).
|
|
119
|
+
|
|
120
|
+
## Maintaining
|
|
121
|
+
If you are a maintainer of this repository, please refer to the [pipeline and release process instructions](../docs/PIPELINE.md).
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
name: 'Frodo Library Release Pipeline'
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- 'main'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
smoke-tests:
|
|
10
|
+
name: 'Smoke Tests'
|
|
11
|
+
# You must use a Linux environment when using service containers or container jobs
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [18, 16, 14]
|
|
16
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
17
|
+
|
|
18
|
+
# Service containers to run with `smoke-tests`
|
|
19
|
+
services:
|
|
20
|
+
# Label used to access the service container
|
|
21
|
+
squid:
|
|
22
|
+
# Docker Hub image
|
|
23
|
+
image: ubuntu/squid
|
|
24
|
+
#
|
|
25
|
+
ports:
|
|
26
|
+
# Maps tcp port 3128 on the host to the same port in the service container
|
|
27
|
+
- 3128:3128
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- name: Checkout repository
|
|
31
|
+
uses: actions/checkout@v2
|
|
32
|
+
with:
|
|
33
|
+
ref: ${{ github.ref }}
|
|
34
|
+
|
|
35
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
36
|
+
uses: actions/setup-node@v2
|
|
37
|
+
with:
|
|
38
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
39
|
+
node-version: ${{ matrix.node-version }}
|
|
40
|
+
cache: 'npm'
|
|
41
|
+
|
|
42
|
+
- name: Install dependencies and install frodo globally
|
|
43
|
+
run: |
|
|
44
|
+
npm ci
|
|
45
|
+
npm i -g
|
|
46
|
+
|
|
47
|
+
#
|
|
48
|
+
# Run tests.
|
|
49
|
+
#
|
|
50
|
+
- name: Test Suites
|
|
51
|
+
env:
|
|
52
|
+
FIDC_TENANT_URL: ${{ secrets.FIDC_TENANT_URL }}
|
|
53
|
+
FIDC_TENANT_ADMIN_USERNAME: ${{ secrets.FIDC_TENANT_ADMIN_USERNAME }}
|
|
54
|
+
FIDC_TENANT_ADMIN_PASSWORD: ${{ secrets.FIDC_TENANT_ADMIN_PASSWORD }}
|
|
55
|
+
run: |
|
|
56
|
+
npm test
|
|
57
|
+
|
|
58
|
+
- name: Security Audit
|
|
59
|
+
run: |
|
|
60
|
+
npm audit
|
|
61
|
+
|
|
62
|
+
# - name: Direct Tests
|
|
63
|
+
# env:
|
|
64
|
+
# FIDC_TENANT_URL: ${{ secrets.FIDC_TENANT_URL }}
|
|
65
|
+
# FIDC_TENANT_ADMIN_USERNAME: ${{ secrets.FIDC_TENANT_ADMIN_USERNAME }}
|
|
66
|
+
# FIDC_TENANT_ADMIN_PASSWORD: ${{ secrets.FIDC_TENANT_ADMIN_PASSWORD }}
|
|
67
|
+
# run: |
|
|
68
|
+
# frodo conn add "$FIDC_TENANT_URL" "$FIDC_TENANT_ADMIN_USERNAME" "$FIDC_TENANT_ADMIN_PASSWORD"
|
|
69
|
+
# frodo info "$FIDC_TENANT_URL"
|
|
70
|
+
|
|
71
|
+
# - name: Proxy Tests
|
|
72
|
+
# env:
|
|
73
|
+
# HTTPS_PROXY: "http://127.0.0.1:3128"
|
|
74
|
+
# FIDC_TENANT_URL: ${{ secrets.FIDC_TENANT_URL }}
|
|
75
|
+
# FIDC_TENANT_ADMIN_USERNAME: ${{ secrets.FIDC_TENANT_ADMIN_USERNAME }}
|
|
76
|
+
# FIDC_TENANT_ADMIN_PASSWORD: ${{ secrets.FIDC_TENANT_ADMIN_PASSWORD }}
|
|
77
|
+
# run: |
|
|
78
|
+
# frodo conn add "$FIDC_TENANT_URL" "$FIDC_TENANT_ADMIN_USERNAME" "$FIDC_TENANT_ADMIN_PASSWORD"
|
|
79
|
+
# frodo info "$FIDC_TENANT_URL"
|
|
80
|
+
|
|
81
|
+
update-changelog:
|
|
82
|
+
needs: smoke-tests
|
|
83
|
+
name: 'Update Changelog'
|
|
84
|
+
runs-on: ubuntu-latest
|
|
85
|
+
|
|
86
|
+
steps:
|
|
87
|
+
- name: 'Checkout source code'
|
|
88
|
+
uses: 'actions/checkout@v2'
|
|
89
|
+
with:
|
|
90
|
+
ref: ${{ github.ref }}
|
|
91
|
+
|
|
92
|
+
- name: 'cat package.json'
|
|
93
|
+
run: cat ./package.json
|
|
94
|
+
|
|
95
|
+
- name: 'Prepare Version Bump'
|
|
96
|
+
id: prepare-version-bump
|
|
97
|
+
uses: 'phips28/gh-action-bump-version@master'
|
|
98
|
+
with:
|
|
99
|
+
major-wording: 'MAJOR RELEASE'
|
|
100
|
+
minor-wording: 'MINOR RELEASE'
|
|
101
|
+
patch-wording: 'PATCH RELEASE'
|
|
102
|
+
rc-wording: ''
|
|
103
|
+
tag-prefix: 'v'
|
|
104
|
+
default: prerelease
|
|
105
|
+
preid: ''
|
|
106
|
+
bump-policy: 'ignore'
|
|
107
|
+
skip-commit: 'true'
|
|
108
|
+
skip-tag: 'true'
|
|
109
|
+
skip-push: 'true'
|
|
110
|
+
env:
|
|
111
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
112
|
+
|
|
113
|
+
- name: Update Changelog
|
|
114
|
+
uses: thomaseizinger/keep-a-changelog-new-release@1.3.0
|
|
115
|
+
with:
|
|
116
|
+
tag: ${{ steps.prepare-version-bump.outputs.newTag }}
|
|
117
|
+
|
|
118
|
+
- name: 'Output Changelog'
|
|
119
|
+
run: cat CHANGELOG.md
|
|
120
|
+
|
|
121
|
+
- name: Commit updated changelog
|
|
122
|
+
id: commit-changelog
|
|
123
|
+
run: |
|
|
124
|
+
git add CHANGELOG.md
|
|
125
|
+
git commit --message "Updated changelog for release ${{ steps.prepare-version-bump.outputs.newTag }}"
|
|
126
|
+
git push
|
|
127
|
+
|
|
128
|
+
- name: 'Output Version'
|
|
129
|
+
env:
|
|
130
|
+
NEW_VERSION: ${{ steps.prepare-version-bump.outputs.newTag }}
|
|
131
|
+
run: echo "new tag $NEW_VERSION"
|
|
132
|
+
|
|
133
|
+
bump-version:
|
|
134
|
+
needs: update-changelog
|
|
135
|
+
name: 'Bump Version'
|
|
136
|
+
runs-on: ubuntu-latest
|
|
137
|
+
|
|
138
|
+
steps:
|
|
139
|
+
- name: 'Checkout Source Code'
|
|
140
|
+
uses: 'actions/checkout@v2'
|
|
141
|
+
with:
|
|
142
|
+
ref: ${{ github.ref }}
|
|
143
|
+
|
|
144
|
+
- name: 'cat package.json'
|
|
145
|
+
run: cat ./package.json
|
|
146
|
+
|
|
147
|
+
- name: 'Automated Version Bump'
|
|
148
|
+
id: version-bump
|
|
149
|
+
uses: 'phips28/gh-action-bump-version@master'
|
|
150
|
+
with:
|
|
151
|
+
major-wording: 'MAJOR RELEASE'
|
|
152
|
+
minor-wording: 'MINOR RELEASE'
|
|
153
|
+
patch-wording: 'PATCH RELEASE'
|
|
154
|
+
rc-wording: ''
|
|
155
|
+
tag-prefix: 'v'
|
|
156
|
+
default: prerelease
|
|
157
|
+
preid: ''
|
|
158
|
+
bump-policy: 'ignore'
|
|
159
|
+
env:
|
|
160
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
161
|
+
|
|
162
|
+
- name: 'cat package.json'
|
|
163
|
+
run: cat ./package.json
|
|
164
|
+
|
|
165
|
+
- name: 'Output Tag'
|
|
166
|
+
env:
|
|
167
|
+
NEW_TAG: ${{ steps.version-bump.outputs.newTag }}
|
|
168
|
+
run: echo "new tag $NEW_TAG"
|
|
169
|
+
|
|
170
|
+
- name: 'Version From Tag'
|
|
171
|
+
id: version-from-tag
|
|
172
|
+
run: echo "::set-output name=version::$(echo '${{ steps.version-bump.outputs.newTag }}' | sed 's/v//')"
|
|
173
|
+
|
|
174
|
+
- name: 'Output Version'
|
|
175
|
+
id: output-version
|
|
176
|
+
run: echo "Version = ${{ steps.version-from-tag.outputs.version }}"
|
|
177
|
+
|
|
178
|
+
outputs:
|
|
179
|
+
newTag: ${{ steps.version-bump.outputs.newTag }}
|
|
180
|
+
newVersion: ${{ steps.version-from-tag.outputs.version }}
|
|
181
|
+
preRelease: ${{ contains(steps.version-bump.outputs.newTag, '-') }}
|
|
182
|
+
|
|
183
|
+
release-notes:
|
|
184
|
+
needs: bump-version
|
|
185
|
+
name: 'Release Notes'
|
|
186
|
+
runs-on: ubuntu-latest
|
|
187
|
+
|
|
188
|
+
steps:
|
|
189
|
+
- name: 'Checkout Source Code'
|
|
190
|
+
uses: 'actions/checkout@v2'
|
|
191
|
+
with:
|
|
192
|
+
ref: ${{ github.ref }}
|
|
193
|
+
|
|
194
|
+
- name: 'Release Header'
|
|
195
|
+
id: release-header
|
|
196
|
+
run: echo "::set-output name=header::$(echo `grep '## \\[${{ needs.bump-version.outputs.newVersion }}] -' CHANGELOG.md | sed 's/## //' | sed 's/\\[//' | sed 's/]//'`)"
|
|
197
|
+
|
|
198
|
+
- name: 'Output Release Header'
|
|
199
|
+
id: output-release-header
|
|
200
|
+
run: echo "Release Header = ${{ steps.release-header.outputs.header }}"
|
|
201
|
+
|
|
202
|
+
- name: 'Extract Release Notes'
|
|
203
|
+
id: extract-release-notes
|
|
204
|
+
uses: 'dahlia/submark@main'
|
|
205
|
+
with:
|
|
206
|
+
input-file: 'CHANGELOG.md'
|
|
207
|
+
heading-level: 2
|
|
208
|
+
heading-title-text: '${{ steps.release-header.outputs.header }}'
|
|
209
|
+
ignore-case: true
|
|
210
|
+
omit-heading: true
|
|
211
|
+
|
|
212
|
+
# The output-file refers to the path of the temporary file which contains
|
|
213
|
+
# the only extracted part:
|
|
214
|
+
- name: 'Output Extracted Release Notes File'
|
|
215
|
+
run: cat ${{ steps.extract-release-notes.outputs.output-file }}
|
|
216
|
+
|
|
217
|
+
# The output-text contains the text of the extracted part.
|
|
218
|
+
- name: 'Output Extracted Release Notes'
|
|
219
|
+
run: echo "${{ steps.extract-release-notes.outputs.output-text }}"
|
|
220
|
+
|
|
221
|
+
outputs:
|
|
222
|
+
notes: ${{ steps.extract-release-notes.outputs.output-text }}
|
|
223
|
+
|
|
224
|
+
release:
|
|
225
|
+
needs: [bump-version, release-notes]
|
|
226
|
+
name: 'Release'
|
|
227
|
+
runs-on: ubuntu-latest
|
|
228
|
+
|
|
229
|
+
steps:
|
|
230
|
+
- name: 'Checkout Source Code'
|
|
231
|
+
uses: 'actions/checkout@v2'
|
|
232
|
+
with:
|
|
233
|
+
ref: ${{ github.ref }}
|
|
234
|
+
|
|
235
|
+
- name: 'Github SHA'
|
|
236
|
+
id: github-sha
|
|
237
|
+
run: echo ${{ github.sha }} > Release.txt
|
|
238
|
+
|
|
239
|
+
- name: 'Test Github SHA'
|
|
240
|
+
id: test-github-sha
|
|
241
|
+
run: cat Release.txt
|
|
242
|
+
|
|
243
|
+
- name: Release
|
|
244
|
+
uses: softprops/action-gh-release@v1
|
|
245
|
+
with:
|
|
246
|
+
name: ${{ needs.bump-version.outputs.newVersion }}
|
|
247
|
+
tag_name: ${{ needs.bump-version.outputs.newTag }}
|
|
248
|
+
body: ${{ needs.release-notes.outputs.notes }}
|
|
249
|
+
prerelease: ${{ needs.bump-version.outputs.preRelease }}
|
|
250
|
+
generate_release_notes: ${{ contains(needs.bump-version.outputs.newTag, '-') }}
|
|
251
|
+
files: |
|
|
252
|
+
CHANGELOG.md
|
|
253
|
+
LICENSE
|
|
254
|
+
Release.txt
|
|
255
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
256
|
+
|
|
257
|
+
outputs:
|
|
258
|
+
newTag: ${{ needs.bump-version.outputs.newTag }}
|
|
259
|
+
newVersion: ${{ needs.bump-version.outputs.newVersion }}
|
|
260
|
+
|
|
261
|
+
npm-release:
|
|
262
|
+
needs: [bump-version, release]
|
|
263
|
+
runs-on: ubuntu-latest
|
|
264
|
+
steps:
|
|
265
|
+
- uses: actions/checkout@v3
|
|
266
|
+
with:
|
|
267
|
+
ref: ${{ github.ref }}
|
|
268
|
+
- uses: actions/setup-node@v3
|
|
269
|
+
with:
|
|
270
|
+
node-version: 14
|
|
271
|
+
- name: Pre-Release
|
|
272
|
+
if: ${{ fromJSON(needs.bump-version.outputs.preRelease) }}
|
|
273
|
+
uses: JS-DevTools/npm-publish@v1
|
|
274
|
+
with:
|
|
275
|
+
tag: 'next'
|
|
276
|
+
token: ${{ secrets.NPM_ACCESS_TOKEN }}
|
|
277
|
+
- name: Release
|
|
278
|
+
if: ${{ ! fromJSON(needs.bump-version.outputs.preRelease) }}
|
|
279
|
+
uses: JS-DevTools/npm-publish@v1
|
|
280
|
+
with:
|
|
281
|
+
token: ${{ secrets.NPM_ACCESS_TOKEN }}
|
|
282
|
+
- name: Remove Pre-Release Tag
|
|
283
|
+
if: ${{ ! fromJSON(needs.bump-version.outputs.preRelease) }}
|
|
284
|
+
run: |
|
|
285
|
+
export INPUT_TOKEN=${{ secrets.NPM_ACCESS_TOKEN }}
|
|
286
|
+
npm whoami
|
|
287
|
+
npm dist-tag rm @rockcarver/frodo-lib next
|