Repository navigation
71 lines (55 loc) · 1.81 KB
/
Copy pathrelease.yml
File metadata and controls
71 lines (55 loc) · 1.81 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Release
on:
release:
types: [published]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
concurrency:
group: release-${{ github.event.release.tag_name }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- uses: actions/setup-node@v4
with:
node-version: '24'
- run: npm install -g npm@latest
- name: Verify release version
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
version="${RELEASE_TAG#v}"
if [[ ! "${RELEASE_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::error::Invalid release tag: ${RELEASE_TAG} (expected vX.Y.Z)"
exit 1
fi
package_version=$(node -p "require('./packages/alpinejs/package.json').version")
if [[ "${package_version}" != "${version}" ]]; then
echo "::error::Release tag ${RELEASE_TAG} does not match package version ${package_version}"
exit 1
fi
- run: npm ci
- name: Build packages
run: npm run build
- name: Publish all packages to npm
run: |
failed=""
for pkg in alpinejs csp intersect collapse persist resize anchor morph focus sort mask ui docs; do
echo "Publishing ${pkg}..."
if ! (cd "packages/${pkg}" && npm publish --access public --provenance); then
echo "::warning::Failed to publish ${pkg}"
failed="${failed} ${pkg}"
fi
done
if [[ -n "${failed}" ]]; then
echo "::error::Failed to publish:${failed}"
exit 1
fi