Skip to content

Commit 50b471c

Browse files
build(ci): Update SDK generation method
1 parent 5779ce3 commit 50b471c

6 files changed

Lines changed: 968 additions & 22 deletions

File tree

.github/workflows/pr.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,20 @@ jobs:
101101
with:
102102
fetch-depth: 0
103103

104-
- name: Setup Node.js 20
105-
if: ${{ ! startsWith(github.head_ref, 'changeset-release/') }}
106-
uses: actions/setup-node@v3
104+
- name: Setup Node.js
105+
uses: actions/setup-node@v6
107106
with:
108107
node-version: 20
109-
cache: 'npm'
108+
cache: "npm"
109+
registry-url: "https://npm.pkg.github.com/"
110+
scope: "@rebilly"
111+
cache-dependency-path: "package-lock.json"
110112

111113
- name: Install Dependencies
112114
if: ${{ ! startsWith(github.head_ref, 'changeset-release/') }}
113115
run: npm ci
116+
env:
117+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114118

115119
- name: Check Changesets
116120
if: ${{ ! startsWith(github.head_ref, 'changeset-release/') }}

.github/workflows/release.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77

8-
concurrency:
8+
concurrency:
99
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

@@ -20,14 +20,19 @@ jobs:
2020
fetch-depth: 0
2121
token: ${{ secrets.MACHINE_USER_PAT }}
2222

23-
- name: Setup Node.js 20
24-
uses: actions/setup-node@v3
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v6
2525
with:
2626
node-version: 20
27-
cache: 'npm'
27+
cache: "npm"
28+
registry-url: "https://npm.pkg.github.com/"
29+
scope: "@rebilly"
30+
cache-dependency-path: "package-lock.json"
2831

2932
- name: Install Dependencies
3033
run: npm ci
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3136

3237
- name: Create Release Pull Request
3338
uses: changesets/action@v1

.github/workflows/update.yaml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ jobs:
5353
extensions: mbstring, intl, curl, json
5454
tools: composer:v2
5555

56+
- name: Setup Node.js
57+
uses: actions/setup-node@v6
58+
with:
59+
node-version: 24
60+
cache: "npm"
61+
registry-url: "https://npm.pkg.github.com/"
62+
scope: "@rebilly"
63+
cache-dependency-path: "sdk/package-lock.json"
64+
65+
5666
- name: Install api-definitions dependencies
5767
working-directory: ./api-definitions
5868
run: npm install
@@ -68,20 +78,18 @@ jobs:
6878
username: ${{ github.actor }}
6979
password: ${{ secrets.MACHINE_USER_PAT }}
7080

81+
- name: Install Dependencies
82+
working-directory: ./sdk
83+
run: npm ci --dev
84+
env:
85+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
7187
- name: Build SDK
88+
working-directory: ./sdk
7289
run: |
7390
mkdir /tmp/sdk
74-
docker run --rm \
75-
-u $(id -u ${USER}):$(id -g ${USER}) \
76-
-v "/tmp/sdk:/out" \
77-
-v "$(pwd)/api-definitions/catalog:/api-definitions" \
78-
ghcr.io/rebilly/regenerator:latest generate \
79-
-g rebilly-php \
80-
-D /out/openapi.json \
81-
-o /out \
82-
-C '{"rootNameSpace": "Rebilly.Sdk", "customOperationGroupMapping": "/shared/custom-resource-names.json"}' \
83-
"/api-definitions/all.yaml"
84-
ls -lAh /tmp/ /tmp/sdk/
91+
rm -rf src
92+
npm run generate /tmp/sdk ../api-definitions/catalog/all.yaml
8593
8694
- name: Bundle SDK
8795
run: |
@@ -129,6 +137,8 @@ jobs:
129137
echo "Added a patch changeset '${CHANGESET_ID}': '${{ github.event.inputs.trigger-reason }}'"
130138
echo "id=${CHANGESET_ID}" >> $GITHUB_OUTPUT
131139
fi
140+
env:
141+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132142

133143
- name: Create PR
134144
id: cpr

0 commit comments

Comments
 (0)