-
-
Notifications
You must be signed in to change notification settings - Fork 8
54 lines (46 loc) · 1.59 KB
/
publish-packages.yml
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
name: publish-packages
on:
push:
tags:
- bundlemon@v*.*.*
- bundlemon-markdown-output@v*.*.*
- bundlemon-utils@v*.*.*
jobs:
test:
name: publish-packages
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # needed for provenance data generation
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract package name
id: package_name
run: echo "value=$(echo $GITHUB_REF_NAME | cut -d '@' -f 1)" >> $GITHUB_OUTPUT
# validate the package.json version is the same as the tag
- name: Validate version
run: |
ACTUAL_VERSION=$(jq -r '.version' packages/${{ steps.package_name.outputs.value }}/package.json)
EXPECTED_VERSION=$(echo $GITHUB_REF_NAME | sed 's/.*@v//')
if [ "$ACTUAL_VERSION" != "$EXPECTED_VERSION" ]; then
echo "Version mismatch between package.json ($ACTUAL_VERSION) and tag ($EXPECTED_VERSION)"
exit 1
fi
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: yarn
- name: Build
run: yarn nx build ${{ steps.package_name.outputs.value }}
- name: Publish packages
run: npx nx release publish --verbose --projects ${{ steps.package_name.outputs.value }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NPM_CONFIG_PROVENANCE: true