Skip to content

Commit 7d23a90

Browse files
committed
ci: modernise the build workflow
1 parent 5eb00c6 commit 7d23a90

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

.github/workflows/build_and_publish.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,52 +33,53 @@ jobs:
3333
message: "chore: build library from latest spec [skip ci]"
3434

3535
- name: Find current API version
36-
run: echo "api_version=$(jq -r .info.version OpenAPI.json)" >> $GITHUB_ENV
36+
id: check-api
37+
run: echo "api-version=$(jq -r .info.version OpenAPI.json)" >> $GITHUB_OUTPUT
3738

3839
- name: Check if tag exists for current version
39-
uses: mukunku/tag-exists-action@v1.2.0
40-
id: checkTag
40+
uses: mukunku/tag-exists-action@v1.6.0
41+
id: check-tag
4142
with:
42-
tag: ${{ env.api_version }}
43+
tag: ${{ steps.check-api.outputs.api-version }}
4344

4445
- name: Update version in package.json
45-
if: ${{ steps.checkTag.outputs.exists }} != true
46+
if: steps.check-tag.outputs.exists == 'false'
4647
run: |
47-
jq '.version="${{ env.api_version }}"' package.json > temp.json
48+
jq '.version="${{ steps.check-api.outputs.api-version }}"' package.json > temp.json
4849
mv temp.json package.json
4950
5051
- name: Commit changes
51-
if: ${{ steps.checkTag.outputs.exists }} != true
52+
if: steps.check-tag.outputs.exists == 'false'
5253
uses: EndBug/add-and-commit@v9
5354
with:
5455
author_name: Stoat CI
5556
author_email: stoat-ci@users.noreply.github.com
56-
tag: "${{ env.api_version }} --force"
57-
message: "chore: bump version to ${{ env.api_version }} [skip ci]"
57+
tag: "${{ steps.check-api.outputs.api-version }} --force"
58+
message: "chore: bump version to ${{ steps.check-api.outputs.api-version }} [skip ci]"
5859

59-
- name: Publish to NPM
60-
if: ${{ steps.checkTag.outputs.exists }} != true
61-
uses: JS-DevTools/npm-publish@v1
62-
with:
63-
token: ${{ secrets.NPM_TOKEN }}
60+
- name: Publish to npm
61+
run: npm publish --provenance --ignore-scripts
62+
if: steps.check-tag.outputs.exists == 'false'
63+
env:
64+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
6465

6566
- name: Checkout stoat.js repository
66-
if: ${{ steps.checkTag.outputs.exists }} != true
67+
if: steps.check-tag.outputs.exists == 'false'
6768
uses: actions/checkout@v3
6869
with:
6970
repository: stoatchat/javascript-client-sdk
7071
path: stoat.js
7172
token: ${{ secrets.GITHUB_TOKEN }}
7273

7374
- name: Update stoat-api dependency
74-
if: ${{ steps.checkTag.outputs.exists }} != true
75-
run: cd stoat.js && pnpm add stoat-api@${{ env.api_version }}
75+
if: steps.check-tag.outputs.exists == 'false'
76+
run: cd stoat.js && pnpm add stoat-api@${{ steps.check-api.outputs.api-version }}
7677

7778
- name: Commit changes
78-
if: ${{ steps.checkTag.outputs.exists }} != true
79+
if: steps.check-tag.outputs.exists == 'false'
7980
uses: EndBug/add-and-commit@v4
8081
with:
8182
cwd: "stoat.js"
8283
author_name: Stoat CI
8384
author_email: stoat-ci@users.noreply.github.com
84-
message: "chore: update stoat-api to ${{ env.api_version }}"
85+
message: "chore: update stoat-api to ${{ steps.check-api.outputs.api-version }}"

0 commit comments

Comments
 (0)