-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.63 KB
/
build-publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: build and publish package
on:
release:
types: [created]
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: write
issues: write
packages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com
- name: Install openapi-generator-cli
run: npm install -g @openapitools/openapi-generator-cli
- name: Generate src
run: openapi-generator-cli generate -i ./docs/cuculus-openapi.yaml -g typescript-fetch -o ./src -c ./config.json
- name: Update package.json version
uses: jossef/action-set-json-field@v1
with:
file: ./package.json
field: version
value: ${{ github.event.release.name }}
- name: Commit and push
run: |
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add -A
git commit -m "${{ github.event.release.name }} - Updated"
git push origin HEAD:main
- name: Package install
run: npm install
- name: Publish package
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}