Skip to content

Commit 9c7e127

Browse files
authored
Workflows release splittext and interact-validate (#255)
* Release workflows for splittext and validate * Prepare versions for release of splittext and interact-validate
1 parent e0aead2 commit 9c7e127

4 files changed

Lines changed: 351 additions & 2 deletions

File tree

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: SplitText - Bump Version and Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
source_branch:
7+
description: 'Source branch for deploy preview (leave empty for regular release from master)'
8+
required: false
9+
default: ''
10+
type: string
11+
version_strategy:
12+
type: choice
13+
description: Version strategy
14+
options:
15+
- prerelease
16+
- premajor
17+
- preminor
18+
- prepatch
19+
- major
20+
- minor
21+
- patch
22+
dry_run:
23+
description: 'Dry run (preview only)'
24+
required: false
25+
default: false
26+
type: boolean
27+
28+
permissions:
29+
id-token: write # REQUIRED for npm Trusted Publishing
30+
contents: write
31+
pull-requests: write
32+
33+
env:
34+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
35+
36+
jobs:
37+
publish:
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
43+
with:
44+
fetch-depth: 0 # full history for yarn version
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
ref: ${{ github.event.inputs.source_branch || github.ref }}
47+
48+
- name: Create and checkout release branch
49+
if: ${{ github.event.inputs.dry_run == 'false' }}
50+
id: release_branch
51+
run: |
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
git config user.name "github-actions[bot]"
54+
if [ -n "${{ github.event.inputs.source_branch }}" ]; then
55+
BRANCH_NAME="release-dp"
56+
else
57+
BRANCH_NAME="release"
58+
fi
59+
echo "name=$BRANCH_NAME" >> $GITHUB_OUTPUT
60+
git checkout -b "$BRANCH_NAME"
61+
git push -u origin "$BRANCH_NAME"
62+
63+
- name: Setup Node with trusted publishing
64+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
65+
with:
66+
node-version: 24
67+
registry-url: https://registry.npmjs.org
68+
69+
- name: Set up Yarn
70+
run: |
71+
corepack enable
72+
corepack prepare yarn@4.10.3 --activate
73+
yarn set version 4.10.3
74+
75+
- name: Install dependencies
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
run: NPQ_PKG_MGR=yarn npx npq install
79+
80+
- name: Build splittext package
81+
run: yarn workspace @wix/splittext build
82+
83+
- name: Test splittext package
84+
run: yarn workspace @wix/splittext test
85+
86+
# ---- BUMP VERSION ----
87+
88+
- name: Set deploy preview version
89+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch != '' }}
90+
working-directory: packages/splittext
91+
run: |
92+
CURRENT_VERSION=$(node -p "require('./package.json').version")
93+
BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/-.*//')
94+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
95+
DP_VERSION="${BASE_VERSION}-dp.${TIMESTAMP}"
96+
yarn version "$DP_VERSION"
97+
98+
- name: Bump version
99+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch == '' }}
100+
working-directory: packages/splittext
101+
run: yarn version ${{ github.event.inputs.version_strategy }}
102+
103+
- name: Get new version
104+
if: ${{ github.event.inputs.dry_run == 'false' }}
105+
id: get_version
106+
working-directory: packages/splittext
107+
run: |
108+
VERSION=$(node -p "require('./package.json').version")
109+
echo "version=$VERSION" >> $GITHUB_OUTPUT
110+
111+
- name: Commit and push version bump
112+
if: ${{ github.event.inputs.dry_run == 'false' }}
113+
run: |
114+
git config user.email "github-actions[bot]@users.noreply.github.com"
115+
git config user.name "github-actions[bot]"
116+
git add .
117+
git commit -m "chore: bump @wix/splittext to ${{ steps.get_version.outputs.version }}"
118+
TAG="splittext@${{ steps.get_version.outputs.version }}"
119+
git tag -a "$TAG" -m "chore: release @wix/splittext ${{ steps.get_version.outputs.version }}"
120+
git push origin ${{ steps.release_branch.outputs.name }}
121+
git push origin "$TAG"
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
125+
# ---- CREATE PULL REQUEST ----
126+
127+
- name: Create Pull Request
128+
if: ${{ github.event.inputs.dry_run == 'false' }}
129+
id: create_pr
130+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
131+
with:
132+
github-token: ${{ secrets.GITHUB_TOKEN }}
133+
script: |
134+
const { data: pr } = await github.rest.pulls.create({
135+
owner: context.repo.owner,
136+
repo: context.repo.repo,
137+
title: `chore: bump @wix/splittext to ${{ steps.get_version.outputs.version }}`,
138+
head: '${{ steps.release_branch.outputs.name }}',
139+
base: '${{ github.event.inputs.source_branch || 'master' }}',
140+
body: 'Automated version bump and release PR',
141+
maintainer_can_modify: true
142+
});
143+
144+
return pr.number;
145+
146+
# ---- PUBLISH WITH TRUSTED PUBLISHING ----
147+
148+
- name: npm publish @wix/splittext deploy preview (trusted)
149+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch != '' }}
150+
run: |
151+
cd packages/splittext
152+
npm publish --tag dp --provenance --access=public
153+
154+
- name: npm publish @wix/splittext RC (trusted)
155+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch == '' && (github.event.inputs.version_strategy == 'prerelease' || github.event.inputs.version_strategy == 'premajor' || github.event.inputs.version_strategy == 'preminor' || github.event.inputs.version_strategy == 'prepatch') }}
156+
run: |
157+
cd packages/splittext
158+
npm publish --tag next --provenance --access=public
159+
160+
- name: npm publish @wix/splittext Stable (trusted)
161+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch == '' && (github.event.inputs.version_strategy == 'major' || github.event.inputs.version_strategy == 'minor' || github.event.inputs.version_strategy == 'patch') }}
162+
run: |
163+
cd packages/splittext
164+
npm publish --tag latest --provenance --access=public
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
name: Interact Validate - Bump Version and Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
source_branch:
7+
description: 'Source branch for deploy preview (leave empty for regular release from master)'
8+
required: false
9+
default: ''
10+
type: string
11+
version_strategy:
12+
type: choice
13+
description: Version strategy
14+
options:
15+
- prerelease
16+
- premajor
17+
- preminor
18+
- prepatch
19+
- major
20+
- minor
21+
- patch
22+
dry_run:
23+
description: 'Dry run (preview only)'
24+
required: false
25+
default: false
26+
type: boolean
27+
28+
permissions:
29+
id-token: write # REQUIRED for npm Trusted Publishing
30+
contents: write
31+
pull-requests: write
32+
33+
env:
34+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
35+
36+
jobs:
37+
publish:
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
43+
with:
44+
fetch-depth: 0 # full history for yarn version
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
ref: ${{ github.event.inputs.source_branch || github.ref }}
47+
48+
- name: Create and checkout release branch
49+
if: ${{ github.event.inputs.dry_run == 'false' }}
50+
id: release_branch
51+
run: |
52+
git config user.email "github-actions[bot]@users.noreply.github.com"
53+
git config user.name "github-actions[bot]"
54+
if [ -n "${{ github.event.inputs.source_branch }}" ]; then
55+
BRANCH_NAME="release-dp"
56+
else
57+
BRANCH_NAME="release"
58+
fi
59+
echo "name=$BRANCH_NAME" >> $GITHUB_OUTPUT
60+
git checkout -b "$BRANCH_NAME"
61+
git push -u origin "$BRANCH_NAME"
62+
63+
- name: Setup Node with trusted publishing
64+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
65+
with:
66+
node-version: 24
67+
registry-url: https://registry.npmjs.org
68+
69+
- name: Set up Yarn
70+
run: |
71+
corepack enable
72+
corepack prepare yarn@4.10.3 --activate
73+
yarn set version 4.10.3
74+
75+
- name: Install dependencies
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
run: NPQ_PKG_MGR=yarn npx npq install
79+
80+
- name: Build motion package
81+
run: yarn workspace @wix/motion build
82+
83+
- name: Build interact package
84+
run: yarn workspace @wix/interact build
85+
86+
- name: Build interact-validate package
87+
run: yarn workspace @wix/interact-validate build
88+
89+
- name: Test interact-validate package
90+
run: yarn workspace @wix/interact-validate test
91+
92+
# ---- UPDATE INTERACT DEPENDENCY FOR DEPLOY PREVIEW ----
93+
94+
- name: Update @wix/interact dependency to deploy preview version
95+
if: ${{ github.event.inputs.source_branch != '' }}
96+
working-directory: packages/interact-validate
97+
run: |
98+
INTERACT_DP_VERSION=$(npm view @wix/interact@dp version)
99+
echo "Using @wix/interact deploy preview version: $INTERACT_DP_VERSION"
100+
node -e "
101+
const fs = require('fs');
102+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
103+
pkg.devDependencies['@wix/interact'] = '${INTERACT_DP_VERSION}';
104+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
105+
"
106+
107+
# ---- BUMP VERSION ----
108+
109+
- name: Set deploy preview version
110+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch != '' }}
111+
working-directory: packages/interact-validate
112+
run: |
113+
CURRENT_VERSION=$(node -p "require('./package.json').version")
114+
BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/-.*//')
115+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
116+
DP_VERSION="${BASE_VERSION}-dp.${TIMESTAMP}"
117+
yarn version "$DP_VERSION"
118+
119+
- name: Bump version
120+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch == '' }}
121+
working-directory: packages/interact-validate
122+
run: yarn version ${{ github.event.inputs.version_strategy }}
123+
124+
- name: Get new version
125+
if: ${{ github.event.inputs.dry_run == 'false' }}
126+
id: get_version
127+
working-directory: packages/interact-validate
128+
run: |
129+
VERSION=$(node -p "require('./package.json').version")
130+
echo "version=$VERSION" >> $GITHUB_OUTPUT
131+
132+
- name: Commit and push version bump
133+
if: ${{ github.event.inputs.dry_run == 'false' }}
134+
run: |
135+
git config user.email "github-actions[bot]@users.noreply.github.com"
136+
git config user.name "github-actions[bot]"
137+
git add .
138+
git commit -m "chore: bump @wix/interact-validate to ${{ steps.get_version.outputs.version }}"
139+
TAG="interact-validate@${{ steps.get_version.outputs.version }}"
140+
git tag -a "$TAG" -m "chore: release @wix/interact-validate ${{ steps.get_version.outputs.version }}"
141+
git push origin ${{ steps.release_branch.outputs.name }}
142+
git push origin "$TAG"
143+
env:
144+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145+
146+
# ---- CREATE PULL REQUEST ----
147+
148+
- name: Create Pull Request
149+
if: ${{ github.event.inputs.dry_run == 'false' }}
150+
id: create_pr
151+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
152+
with:
153+
github-token: ${{ secrets.GITHUB_TOKEN }}
154+
script: |
155+
const { data: pr } = await github.rest.pulls.create({
156+
owner: context.repo.owner,
157+
repo: context.repo.repo,
158+
title: `chore: bump @wix/interact-validate to ${{ steps.get_version.outputs.version }}`,
159+
head: '${{ steps.release_branch.outputs.name }}',
160+
base: '${{ github.event.inputs.source_branch || 'master' }}',
161+
body: 'Automated version bump and release PR',
162+
maintainer_can_modify: true
163+
});
164+
165+
return pr.number;
166+
167+
# ---- PUBLISH WITH TRUSTED PUBLISHING ----
168+
169+
- name: npm publish @wix/interact-validate deploy preview (trusted)
170+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch != '' }}
171+
run: |
172+
cd packages/interact-validate
173+
npm publish --tag dp --provenance --access=public
174+
175+
- name: npm publish @wix/interact-validate RC (trusted)
176+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch == '' && (github.event.inputs.version_strategy == 'prerelease' || github.event.inputs.version_strategy == 'premajor' || github.event.inputs.version_strategy == 'preminor' || github.event.inputs.version_strategy == 'prepatch') }}
177+
run: |
178+
cd packages/interact-validate
179+
npm publish --tag next --provenance --access=public
180+
181+
- name: npm publish @wix/interact-validate Stable (trusted)
182+
if: ${{ github.event.inputs.dry_run == 'false' && github.event.inputs.source_branch == '' && (github.event.inputs.version_strategy == 'major' || github.event.inputs.version_strategy == 'minor' || github.event.inputs.version_strategy == 'patch') }}
183+
run: |
184+
cd packages/interact-validate
185+
npm publish --tag latest --provenance --access=public

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1010

1111
## @wix/splittext
1212

13-
### [0.1.0] - unreleased
13+
### [1.0.0] - unreleased
1414

1515
#### Added
1616

packages/interact-validate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wix/interact-validate",
3-
"version": "1.0.0",
3+
"version": "0.1.0",
44
"description": "Schema + referential + semantic validation for @wix/interact's InteractConfig.",
55
"license": "MIT",
66
"main": "dist/cjs/index.js",

0 commit comments

Comments
 (0)