Skip to content

Commit af560bb

Browse files
committed
chore(ci): deploy updated
1 parent fff0137 commit af560bb

File tree

4 files changed

+91
-26
lines changed

4 files changed

+91
-26
lines changed

.github/workflows/release.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
registry-url: 'https://registry.npmjs.org'
27+
28+
- name: Update npm
29+
run: npm install -g npm@latest
30+
31+
- name: Extract version from tag
32+
id: tag_version
33+
run: |
34+
TAG_NAME=${GITHUB_REF#refs/tags/}
35+
VERSION=${TAG_NAME#v}
36+
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
38+
echo "Extracted version: $VERSION from tag: $TAG_NAME"
39+
40+
- name: Install dependencies
41+
run: npm install
42+
43+
- name: Switch to default branch and align with tag commit
44+
run: |
45+
DEFAULT_BRANCH="${{ github.event.repository.default_branch }}"
46+
git fetch origin "$DEFAULT_BRANCH"
47+
git checkout "$DEFAULT_BRANCH"
48+
git merge --ff-only "$GITHUB_SHA"
49+
50+
- name: Update project package.json versions
51+
run: |
52+
VERSION="${{ steps.tag_version.outputs.version }}"
53+
echo "Setting project versions to $VERSION"
54+
for project in photo-editor scroll-header scroll-strategies; do
55+
echo "Updating projects/$project/package.json..."
56+
cd "projects/$project"
57+
npm version "$VERSION" --no-git-tag-version
58+
cd ../..
59+
done
60+
61+
- name: Build all projects
62+
run: npm run prebuild
63+
64+
- name: Commit changes
65+
run: |
66+
git config --local user.email "action@github.com"
67+
git config --local user.name "GitHub Action"
68+
git add projects/*/package.json
69+
git commit -m "chore: update project versions to ${{ steps.tag_version.outputs.version }}" || exit 0
70+
git push origin HEAD
71+
72+
- name: Publish packages
73+
run: |
74+
VERSION="${{ steps.tag_version.outputs.version }}"
75+
IS_STABLE=$(echo "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' && echo true || echo false)
76+
77+
for project in photo-editor scroll-header scroll-strategies; do
78+
echo "Publishing $project..."
79+
cd "dist/$project"
80+
if [ "$IS_STABLE" = "true" ]; then
81+
npm publish --provenance --access public
82+
else
83+
npm publish --provenance --access public --tag next
84+
fi
85+
cd ../..
86+
done
87+

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"prebuild:scroll-strategies": "ng build scroll-strategies --configuration=production",
2727
"prebuild": "npm run prebuild:photo-editor && npm run prebuild:scroll-header && npm run prebuild:scroll-strategies",
2828
"prestart": "npm run prebuild",
29-
"release": "np --no-tests --no-publish && node release.mjs",
29+
"release": "np --no-tests --no-publish",
3030
"lint": "ng lint"
3131
},
3232
"private": false,

release.mjs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)