@openactive/models-ts 1.0.4 → 1.0.6
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.
|
@@ -4,55 +4,92 @@ on:
|
|
|
4
4
|
workflow_dispatch:
|
|
5
5
|
repository_dispatch:
|
|
6
6
|
types: [data-models-update]
|
|
7
|
+
# Lets other repositories (e.g. models-lib pull requests) test the TypeScript models generated
|
|
8
|
+
# from a specific models-lib or data-models ref. In that case no pull request is created.
|
|
9
|
+
workflow_call:
|
|
10
|
+
inputs:
|
|
11
|
+
models-lib_ref:
|
|
12
|
+
required: false
|
|
13
|
+
type: string
|
|
14
|
+
data-models_ref:
|
|
15
|
+
required: false
|
|
16
|
+
type: string
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
7
20
|
|
|
8
21
|
jobs:
|
|
9
22
|
generate:
|
|
10
23
|
runs-on: ubuntu-latest
|
|
11
24
|
|
|
12
25
|
steps:
|
|
26
|
+
# The repository is named explicitly, as this workflow can be called from another repository
|
|
13
27
|
- name: Checkout models-ts
|
|
14
|
-
uses: actions/checkout@
|
|
28
|
+
uses: actions/checkout@v4
|
|
15
29
|
with:
|
|
30
|
+
repository: openactive/models-ts
|
|
16
31
|
ref: main
|
|
17
32
|
path: models-ts
|
|
18
33
|
|
|
19
34
|
- name: Checkout models-lib
|
|
20
|
-
uses: actions/checkout@
|
|
35
|
+
uses: actions/checkout@v4
|
|
21
36
|
with:
|
|
22
37
|
repository: openactive/models-lib
|
|
38
|
+
ref: ${{ inputs.models-lib_ref }}
|
|
23
39
|
path: models-lib
|
|
24
40
|
|
|
25
|
-
- name: Setup Node.js
|
|
26
|
-
uses: actions/setup-node@
|
|
41
|
+
- name: Setup Node.js 18.17.1
|
|
42
|
+
uses: actions/setup-node@v4
|
|
27
43
|
with:
|
|
28
|
-
node-version:
|
|
29
|
-
|
|
44
|
+
node-version: 18.17.1
|
|
45
|
+
|
|
30
46
|
- name: Install models-lib
|
|
31
47
|
run: npm install
|
|
32
48
|
working-directory: ./models-lib/
|
|
33
|
-
|
|
49
|
+
|
|
34
50
|
- name: Update models-lib with latest data-models
|
|
51
|
+
if: ${{ !inputs.data-models_ref }}
|
|
35
52
|
run: npm update @openactive/data-models
|
|
36
53
|
working-directory: ./models-lib/
|
|
37
54
|
|
|
55
|
+
- name: Install data-models ${{ inputs.data-models_ref }}
|
|
56
|
+
if: ${{ inputs.data-models_ref }}
|
|
57
|
+
env:
|
|
58
|
+
DATA_MODELS_REF: ${{ inputs.data-models_ref }}
|
|
59
|
+
run: npm install "github:openactive/data-models#$DATA_MODELS_REF"
|
|
60
|
+
working-directory: ./models-lib/
|
|
61
|
+
|
|
38
62
|
- name: Run TypeScript models generator
|
|
39
63
|
run: npm start -- generate TypeScript --destination ../models-ts/src/
|
|
40
64
|
working-directory: ./models-lib/
|
|
41
|
-
|
|
65
|
+
|
|
42
66
|
- name: Install models-ts
|
|
43
67
|
run: npm install
|
|
44
68
|
working-directory: ./models-ts/
|
|
45
|
-
|
|
69
|
+
|
|
46
70
|
- name: Build models-ts types
|
|
47
71
|
run: npm run build
|
|
48
72
|
working-directory: ./models-ts/
|
|
49
|
-
|
|
73
|
+
|
|
74
|
+
- name: Test models-ts
|
|
75
|
+
run: npm test
|
|
76
|
+
working-directory: ./models-ts/
|
|
77
|
+
|
|
78
|
+
- name: Generate GitHub App Token
|
|
79
|
+
if: ${{ !inputs.models-lib_ref && !inputs.data-models_ref }}
|
|
80
|
+
uses: actions/create-github-app-token@v1
|
|
81
|
+
id: generate-token
|
|
82
|
+
with:
|
|
83
|
+
app-id: ${{ secrets.GH_APP_ID }}
|
|
84
|
+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
|
85
|
+
|
|
50
86
|
- name: Create Pull Request
|
|
87
|
+
if: ${{ !inputs.models-lib_ref && !inputs.data-models_ref }}
|
|
51
88
|
id: cpr
|
|
52
|
-
uses: peter-evans/create-pull-request@
|
|
89
|
+
uses: peter-evans/create-pull-request@v7
|
|
53
90
|
with:
|
|
54
91
|
path: ./models-ts/
|
|
55
|
-
token: ${{
|
|
92
|
+
token: ${{ steps.generate-token.outputs.token }}
|
|
56
93
|
commit-message: Update data models
|
|
57
94
|
committer: openactive-bot <openactive-bot@users.noreply.github.com>
|
|
58
95
|
author: openactive-bot <openactive-bot@users.noreply.github.com>
|
|
@@ -67,6 +104,10 @@ jobs:
|
|
|
67
104
|
draft: false
|
|
68
105
|
|
|
69
106
|
- name: Check outputs
|
|
107
|
+
if: ${{ !inputs.models-lib_ref && !inputs.data-models_ref }}
|
|
108
|
+
env:
|
|
109
|
+
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
|
|
110
|
+
PR_URL: ${{ steps.cpr.outputs.pull-request-url }}
|
|
70
111
|
run: |
|
|
71
|
-
echo "Pull Request Number - $
|
|
72
|
-
echo "Pull Request URL - $
|
|
112
|
+
echo "Pull Request Number - $PR_NUMBER"
|
|
113
|
+
echo "Pull Request URL - $PR_URL"
|
|
@@ -4,34 +4,50 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches: [ main ]
|
|
6
6
|
|
|
7
|
+
# Never run two publishes at once; a second merge waits for the first to finish
|
|
8
|
+
concurrency:
|
|
9
|
+
group: publish-to-npm
|
|
10
|
+
cancel-in-progress: false
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
7
15
|
jobs:
|
|
8
16
|
publish:
|
|
9
17
|
runs-on: ubuntu-latest
|
|
10
|
-
|
|
18
|
+
# Loop guard: the version bump commit below is pushed by the OpenActive GitHub App, and also carries [skip ci]
|
|
19
|
+
if: ${{ github.actor != 'openactive[bot]' }}
|
|
11
20
|
|
|
12
21
|
steps:
|
|
22
|
+
- name: Generate GitHub App Token
|
|
23
|
+
uses: actions/create-github-app-token@v1
|
|
24
|
+
id: generate-token
|
|
25
|
+
with:
|
|
26
|
+
app-id: ${{ secrets.GH_APP_ID }}
|
|
27
|
+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
|
13
28
|
- name: Checkout
|
|
14
|
-
uses: actions/checkout@
|
|
29
|
+
uses: actions/checkout@v4
|
|
15
30
|
with:
|
|
16
|
-
token: ${{
|
|
31
|
+
token: ${{ steps.generate-token.outputs.token }}
|
|
17
32
|
- name: Identify
|
|
18
33
|
run: |
|
|
19
|
-
git config user.name
|
|
20
|
-
git config user.email
|
|
21
|
-
- name: Use Node.js
|
|
22
|
-
uses: actions/setup-node@
|
|
34
|
+
git config --global user.name "openactive[bot]"
|
|
35
|
+
git config --global user.email 207210293+openactive[bot]@users.noreply.github.com
|
|
36
|
+
- name: Use Node.js 18.17.1
|
|
37
|
+
uses: actions/setup-node@v4
|
|
23
38
|
with:
|
|
24
|
-
node-version:
|
|
39
|
+
node-version: 18.17.1
|
|
25
40
|
registry-url: https://registry.npmjs.org/
|
|
26
41
|
- name: Install
|
|
27
42
|
run: npm ci
|
|
28
43
|
- name: Test
|
|
29
44
|
run: npm test
|
|
30
45
|
- name: Increment Version
|
|
31
|
-
run: npm version patch
|
|
46
|
+
run: npm version patch -m "%s [skip ci]"
|
|
47
|
+
# Push before publishing: if the push is rejected, nothing is published, so npm can never get ahead of GitHub
|
|
48
|
+
- name: Push version update
|
|
49
|
+
run: git push origin HEAD:main
|
|
32
50
|
- name: Publish to npm
|
|
33
51
|
run: npm publish
|
|
34
52
|
env:
|
|
35
|
-
NODE_AUTH_TOKEN: ${{secrets.
|
|
36
|
-
- name: Push version update
|
|
37
|
-
run: git push
|
|
53
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN2 }}
|