Skip to content

Commit 16d5f58

Browse files
committed
chore: setup publish workflow
1 parent ec7d867 commit 16d5f58

File tree

1 file changed

+54
-9
lines changed

1 file changed

+54
-9
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
name: Yarn Cache Dir
2222
run: echo "cache-dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
2323
- name: Restore Lockfile
24-
uses: actions/cache@v3
24+
uses: actions/cache@v5
2525
with:
2626
path: yarn.lock
2727
key: yarn-lock-${{ github.sha }}
2828
- name: Restore Cache
29-
uses: actions/cache@v3
29+
uses: actions/cache@v5
3030
with:
3131
path: ${{ steps.cache.outputs.cache-dir }}
3232
key: yarn-cache-${{ github.sha }}-node-22
@@ -51,12 +51,12 @@ jobs:
5151
- name: Enable Corepack
5252
run: corepack enable
5353
- name: Restore Lockfile
54-
uses: actions/cache@v3
54+
uses: actions/cache@v5
5555
with:
5656
path: yarn.lock
5757
key: yarn-lock-${{ github.sha }}
5858
- name: Restore Cache
59-
uses: actions/cache@v3
59+
uses: actions/cache@v5
6060
with:
6161
path: ${{ needs.prepare.outputs.cache-dir }}
6262
key: yarn-cache-${{ github.sha }}-node-22
@@ -65,7 +65,7 @@ jobs:
6565
- name: Build
6666
run: yarn build
6767
- name: Upload Packages
68-
uses: actions/upload-artifact@v4
68+
uses: actions/upload-artifact@v6
6969
with:
7070
name: packages
7171
path: |
@@ -88,12 +88,12 @@ jobs:
8888
- name: Enable Corepack
8989
run: corepack enable
9090
- name: Restore Lockfile
91-
uses: actions/cache@v3
91+
uses: actions/cache@v5
9292
with:
9393
path: yarn.lock
9494
key: yarn-lock-${{ github.sha }}
9595
- name: Restore Cache
96-
uses: actions/cache@v3
96+
uses: actions/cache@v5
9797
with:
9898
path: ${{ needs.prepare.outputs.cache-dir }}
9999
key: yarn-cache-${{ github.sha }}-node-22
@@ -123,12 +123,12 @@ jobs:
123123
- name: Enable Corepack
124124
run: corepack enable
125125
- name: Restore Lockfile
126-
uses: actions/cache@v3
126+
uses: actions/cache@v5
127127
with:
128128
path: yarn.lock
129129
key: yarn-lock-${{ github.sha }}
130130
- name: Restore Cache
131-
uses: actions/cache@v3
131+
uses: actions/cache@v5
132132
with:
133133
path: ${{ needs.prepare.outputs.cache-dir }}
134134
key: yarn-cache-${{ github.sha }}-node-${{ matrix.node-version }}
@@ -143,3 +143,48 @@ jobs:
143143
token: ${{ secrets.CODECOV_TOKEN }}
144144
file: ./coverage/coverage-final.json
145145
name: codecov
146+
147+
publish:
148+
needs: [prepare, build]
149+
150+
if: |
151+
contains(fromJson('[
152+
"refs/heads/main",
153+
"refs/heads/master",
154+
"refs/heads/v4"
155+
]'), github.ref)
156+
157+
permissions:
158+
id-token: write
159+
contents: read
160+
161+
runs-on: ubuntu-latest
162+
steps:
163+
- name: Check out
164+
uses: actions/checkout@v6
165+
- name: Set up Node
166+
uses: actions/setup-node@v6
167+
with:
168+
node-version: 22
169+
- name: Enable Corepack
170+
run: corepack enable
171+
- name: Restore Lockfile
172+
uses: actions/cache@v5
173+
with:
174+
path: yarn.lock
175+
key: yarn-lock-${{ github.sha }}
176+
- name: Restore Cache
177+
uses: actions/cache@v5
178+
with:
179+
path: ${{ needs.prepare.outputs.cache-dir }}
180+
key: yarn-cache-${{ github.sha }}-node-${{ matrix.node-version }}
181+
restore-keys: yarn-cache-${{ github.sha }}-node
182+
- name: Install
183+
run: yarn --no-immutable
184+
- name: Build
185+
run: yarn build
186+
- name: Publish
187+
run: |-
188+
yarn config set npmPublishProvenance true
189+
yarn config set npmRegistryServer https://registry.npmjs.org/
190+
yarn pub --debug

0 commit comments

Comments
 (0)