Skip to content

Commit 25fb407

Browse files
chore(ci): update pipelines (#1082)
* chore(ci): update pipelines * unify publish pipelines
1 parent bde4851 commit 25fb407

File tree

6 files changed

+136
-215
lines changed

6 files changed

+136
-215
lines changed

.github/workflows/alpha.release.yml

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

.github/workflows/deploy-visual-reporter.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ jobs:
2525

2626
steps:
2727
- name: ⬇️ Checkout Repository
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2929

3030
- name: 📦 Setup pnpm
31-
uses: pnpm/action-setup@v4
31+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
3232

33-
- name: 🟢 Setup Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v3
33+
- name: 🟢 Setup Node.js
34+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
3535
with:
36-
node-version: ${{ matrix.node-version }}
36+
node-version-file: ".nvmrc"
3737
cache: pnpm
3838
- name: 🧩 Install Dependencies
3939
run: pnpm pnpm.install.workaround
@@ -47,13 +47,13 @@ jobs:
4747
GITHUB_PAGES: "/visual-testing/"
4848

4949
- name: ⚙️ Setup Pages
50-
uses: actions/configure-pages@v5
50+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
5151

5252
- name: 📤 Upload artifact
53-
uses: actions/upload-pages-artifact@v3
53+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
5454
with:
5555
path: "packages/visual-reporter/build/client"
5656

5757
- name: 🚀 Deploy to GitHub Pages
5858
id: deployment
59-
uses: actions/deploy-pages@v4
59+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.github/workflows/expense.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
authorize:
4242
runs-on: ubuntu-latest
4343
steps:
44-
- uses: octokit/request-action@v2.1.9
44+
- uses: octokit/request-action@dad4362715b7fb2ddedf9772c8670824af564f0d # v2.4.0
4545
with:
4646
route: GET /orgs/:organisation/teams/:team/memberships/${{ github.actor }}
4747
team: technical-steering-committee
@@ -56,7 +56,7 @@ jobs:
5656
runs-on: ubuntu-latest
5757
steps:
5858
- name: Run Expense Flow
59-
uses: webdriverio/expense-action@v1
59+
uses: webdriverio/expense-action@1612787adc5a33202b53c80d643258fe741bcb74 # v1.3.0
6060
with:
6161
prNumber: ${{ github.event.inputs.prNumber }}
6262
amount: ${{ github.event.inputs.amount }}

.github/workflows/release.yml

Lines changed: 83 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,126 @@
11
name: Release
22

3-
on: [workflow_dispatch]
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: "Select the release type"
8+
required: true
9+
default: "production"
10+
type: choice
11+
options:
12+
- production
13+
- alpha
14+
package_dir:
15+
description: "Select the package directory (only for alpha releases)"
16+
required: false
17+
default: "packages/visual-service"
18+
type: choice
19+
options:
20+
- packages/ocr-service
21+
- packages/visual-reporter
22+
- packages/visual-service
23+
- packages/webdriver-image-comparison
424

525
concurrency: ${{ github.workflow }}-${{ github.ref }}
626

727
env:
828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1029
NPM_CONFIG_PROVENANCE: true
1130

1231
jobs:
1332
release:
14-
name: Release
33+
name: ${{ github.event.inputs.release_type == 'alpha' && 'Alpha Release' || 'Production Release' }}
1534
runs-on: ubuntu-latest
1635
permissions:
1736
contents: write
1837
packages: write
1938
id-token: write
2039
pull-requests: write
2140

22-
strategy:
23-
matrix:
24-
node-version: [20.x]
25-
2641
steps:
2742
- name: ⬇️ Checkout Repository
28-
uses: actions/checkout@v4
43+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
44+
with:
45+
fetch-depth: 0
2946

3047
- name: 🔧 Setup Git
3148
run: |
3249
git config --global user.email "[email protected]"
3350
git config --global user.name "WebdriverIO Release Bot"
3451
3552
- name: 🔧 Setup pnpm
36-
uses: pnpm/action-setup@v4
53+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
3754

38-
- name: 🔧 Setup NPM
39-
run: |
40-
npm set registry "https://registry.npmjs.org/"
41-
npm set //registry.npmjs.org/:_authToken $NPM_TOKEN
42-
npm whoami
43-
44-
- name: 🔧 Setup Node.js ${{ matrix.node-version }}
45-
uses: actions/setup-node@v4
55+
- name: 🔧 Setup Node.js
56+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
4657
with:
47-
node-version: ${{ matrix.node-version }}
58+
node-version-file: ".nvmrc"
4859
cache: pnpm
4960

5061
- name: 🧩 Install Dependencies
5162
run: pnpm pnpm.install.workaround
5263

53-
- name: 🏗️ Build
64+
# ========================================
65+
# Alpha Release Steps
66+
# ========================================
67+
- name: 🔄 Validate Package Directory
68+
if: github.event.inputs.release_type == 'alpha'
69+
run: |
70+
if [[ ! "${{ github.event.inputs.package_dir }}" =~ ^packages/[a-zA-Z0-9_-]+$ ]]; then
71+
echo "Invalid package directory: ${{ github.event.inputs.package_dir }}"
72+
exit 1
73+
fi
74+
if [[ ! -d "${{ github.event.inputs.package_dir }}" ]]; then
75+
echo "Package directory does not exist: ${{ github.event.inputs.package_dir }}"
76+
exit 1
77+
fi
78+
79+
- name: 🏗️ Build the Package (Alpha)
80+
if: github.event.inputs.release_type == 'alpha'
81+
run: |
82+
cd ${{ github.event.inputs.package_dir }}
83+
pnpm build
84+
85+
- name: 🔢 Bump Version for Alpha Release
86+
if: github.event.inputs.release_type == 'alpha'
87+
run: |
88+
cd ${{ github.event.inputs.package_dir }}
89+
npm version prerelease --preid=alpha
90+
91+
- name: 📦 Commit and Push Version Changes (Alpha)
92+
if: github.event.inputs.release_type == 'alpha'
93+
working-directory: ${{ github.event.inputs.package_dir }}
94+
run: |
95+
git add package.json
96+
git commit -m "chore: bump version for alpha release [skip ci]"
97+
git push origin HEAD
98+
99+
- name: 🚀 Publish to npm with Alpha Tag
100+
if: github.event.inputs.release_type == 'alpha'
101+
run: |
102+
cd ${{ github.event.inputs.package_dir }}
103+
npm publish --tag alpha
104+
105+
- name: 📦 Push Tags to GitHub (Alpha)
106+
if: github.event.inputs.release_type == 'alpha'
107+
run: |
108+
cd ${{ github.event.inputs.package_dir }}
109+
git push --follow-tags
110+
111+
# ========================================
112+
# Production Release Steps
113+
# ========================================
114+
- name: 🏗️ Build (Production)
115+
if: github.event.inputs.release_type == 'production'
54116
id: build-the-mono-repo
55117
run: |
56118
pnpm build
57119
58120
- name: 📣 Create Release Pull Request or Publish to npm
121+
if: github.event.inputs.release_type == 'production'
59122
id: changesets
60-
uses: changesets/action@v1
123+
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
61124
with:
62125
# This expects you to have a script called release which does a build for your packages and calls changeset publish
63126
publish: pnpm release

0 commit comments

Comments
 (0)