-
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (112 loc) · 4.95 KB
/
release-native.yml
File metadata and controls
134 lines (112 loc) · 4.95 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Release Native Packages
on:
workflow_dispatch:
inputs:
release_version:
description: 'Release type'
required: true
type: choice
options:
- patch
- minor
- major
- premajor
- preminor
- prepatch
dry_run:
description: 'Dry run (no actual release)'
required: false
type: boolean
default: false
jobs:
release-native:
name: Release Native Packages
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm turbo run build --filter='@wdio/native-types...' --filter='@wdio/native-utils...'
- name: Calculate versions
id: version
run: |
echo "Calculating versions for native packages..."
# Calculate version for native-types
TYPES_RESULT=$(pnpm --loglevel=error package-versioner --bump ${{ inputs.release_version }} --dry-run --json -t @wdio/native-types)
TYPES_VERSION=$(echo "$TYPES_RESULT" | jq -r '.updates[0].newVersion // empty')
# Calculate version for native-utils
UTILS_RESULT=$(pnpm --loglevel=error package-versioner --bump ${{ inputs.release_version }} --dry-run --json -t @wdio/native-utils)
UTILS_VERSION=$(echo "$UTILS_RESULT" | jq -r '.updates[0].newVersion // empty')
if [ -z "$TYPES_VERSION" ] || [ -z "$UTILS_VERSION" ]; then
echo "❌ Failed to calculate versions"
exit 1
fi
echo "📦 @wdio/native-types: $TYPES_VERSION"
echo "📦 @wdio/native-utils: $UTILS_VERSION"
echo "types_version=$TYPES_VERSION" >> $GITHUB_OUTPUT
echo "utils_version=$UTILS_VERSION" >> $GITHUB_OUTPUT
- name: Update package versions
if: ${{ !inputs.dry_run }}
run: |
# Configure git first (needed by package-versioner for commits)
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
echo "Updating native-types to ${{ steps.version.outputs.types_version }}..."
pnpm --loglevel=error package-versioner --bump ${{ inputs.release_version }} -t @wdio/native-types
echo "Updating native-utils to ${{ steps.version.outputs.utils_version }}..."
pnpm --loglevel=error package-versioner --bump ${{ inputs.release_version }} -t @wdio/native-utils
# Push changes (package-versioner already committed)
git push
- name: Publish to NPM
if: ${{ !inputs.dry_run }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: |
echo "Publishing @wdio/native-types@${{ steps.version.outputs.types_version }}..."
cd packages/native-types
pnpm publish --access public --no-git-checks
cd ../..
echo "Publishing @wdio/native-utils@${{ steps.version.outputs.utils_version }}..."
cd packages/native-utils
pnpm publish --access public --no-git-checks
cd ../..
- name: Create GitHub Releases
if: ${{ !inputs.dry_run }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create release for native-types
gh release create "@wdio/native-types@v${{ steps.version.outputs.types_version }}" \
--title "@wdio/native-types v${{ steps.version.outputs.types_version }}" \
--notes-file packages/native-types/CHANGELOG.md \
--latest=false
# Create release for native-utils
gh release create "@wdio/native-utils@v${{ steps.version.outputs.utils_version }}" \
--title "@wdio/native-utils v${{ steps.version.outputs.utils_version }}" \
--notes-file packages/native-utils/CHANGELOG.md \
--latest=false
- name: Summary
run: |
echo "## 📦 Native Packages Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Package | Version | Status |" >> $GITHUB_STEP_SUMMARY
echo "|---------|---------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| @wdio/native-types | ${{ steps.version.outputs.types_version }} | ${{ inputs.dry_run && '🧪 Dry Run' || '✅ Published' }} |" >> $GITHUB_STEP_SUMMARY
echo "| @wdio/native-utils | ${{ steps.version.outputs.utils_version }} | ${{ inputs.dry_run && '🧪 Dry Run' || '✅ Published' }} |" >> $GITHUB_STEP_SUMMARY