-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (88 loc) · 3.21 KB
/
Copy pathpublish-packages.yml
File metadata and controls
104 lines (88 loc) · 3.21 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
name: Publish Packages to pub.dev
on:
push:
tags:
- 'Release/[0-9]+.[0-9]+.[0-9]+*' # matches Release/0.2.0-beta, Release/1.0.0, etc.
permissions:
contents: read
id-token: write # Required for OIDC authentication with pub.dev
jobs:
publish:
runs-on: ubuntu-latest
environment: pub.dev # Optional: requires approval before publishing
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/Release/}" >> $GITHUB_OUTPUT
- name: Prepare packages for publishing
run: dart tools/prepare_publish.dart ${{ steps.version.outputs.VERSION }}
- name: Verify package contents
run: |
for pkg in dart_node_core dart_node_express dart_node_ws dart_node_react dart_node_react_native; do
echo "=== $pkg pubspec.yaml ==="
cat packages/$pkg/pubspec.yaml
echo ""
done
# Publish packages in dependency order
# dart-lang/setup-dart handles OIDC token provisioning automatically
- name: Publish dart_node_core
run: |
cd packages/dart_node_core
dart pub get
dart pub publish --force
- name: Wait for dart_node_core on pub.dev
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
echo "Waiting for dart_node_core $VERSION to be available on pub.dev..."
for i in {1..60}; do
if curl -s "https://pub.dev/api/packages/dart_node_core/versions/$VERSION" | grep -q '"version"'; then
echo "dart_node_core $VERSION is now available!"
exit 0
fi
echo "Attempt $i/60: Not yet available, waiting 10 seconds..."
sleep 10
done
echo "Timeout waiting for dart_node_core to be available"
exit 1
- name: Publish dart_node_express
run: |
cd packages/dart_node_express
dart pub get
dart pub publish --force
- name: Publish dart_node_ws
run: |
cd packages/dart_node_ws
dart pub get
dart pub publish --force
- name: Publish dart_node_react
run: |
cd packages/dart_node_react
dart pub get
dart pub publish --force
- name: Wait for dart_node_react on pub.dev
env:
VERSION: ${{ steps.version.outputs.VERSION }}
run: |
echo "Waiting for dart_node_react $VERSION to be available on pub.dev..."
for i in {1..60}; do
if curl -s "https://pub.dev/api/packages/dart_node_react/versions/$VERSION" | grep -q '"version"'; then
echo "dart_node_react $VERSION is now available!"
exit 0
fi
echo "Attempt $i/60: Not yet available, waiting 10 seconds..."
sleep 10
done
echo "Timeout waiting for dart_node_react to be available"
exit 1
- name: Publish dart_node_react_native
run: |
cd packages/dart_node_react_native
dart pub get
dart pub publish --force