Skip to content

Commit 396f3b0

Browse files
Automate Publishing All Packages (#11)
1 parent 3b60875 commit 396f3b0

5 files changed

Lines changed: 126 additions & 106 deletions

File tree

.github/workflows/publish-core.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish dart_node_core
2+
3+
on:
4+
push:
5+
tags:
6+
- 'Release/[0-9]+.[0-9]+.[0-9]+*'
7+
8+
permissions:
9+
contents: read
10+
id-token: write
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
environment: pub.dev
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Dart
22+
uses: dart-lang/setup-dart@v1
23+
with:
24+
sdk: stable
25+
26+
- name: Extract version from tag
27+
id: version
28+
run: echo "VERSION=${GITHUB_REF#refs/tags/Release/}" >> $GITHUB_OUTPUT
29+
30+
- name: Prepare packages for publishing
31+
run: dart tools/prepare_publish.dart ${{ steps.version.outputs.VERSION }}
32+
33+
- name: Publish dart_node_core
34+
run: |
35+
chmod +x tools/publish_package.sh
36+
./tools/publish_package.sh dart_node_core

.github/workflows/publish-packages.yml

Lines changed: 0 additions & 106 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish Tier 1 (express, ws, react)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to publish (e.g., 0.4.0-beta)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
environment: pub.dev
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Dart
25+
uses: dart-lang/setup-dart@v1
26+
with:
27+
sdk: stable
28+
29+
- name: Prepare packages for publishing
30+
run: dart tools/prepare_publish.dart ${{ inputs.version }}
31+
32+
- name: Publish dart_node_express
33+
run: |
34+
chmod +x tools/publish_package.sh
35+
./tools/publish_package.sh dart_node_express
36+
37+
- name: Publish dart_node_ws
38+
run: ./tools/publish_package.sh dart_node_ws
39+
40+
- name: Publish dart_node_react
41+
run: ./tools/publish_package.sh dart_node_react
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish Tier 2 (react_native)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to publish (e.g., 0.4.0-beta)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
environment: pub.dev
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Dart
25+
uses: dart-lang/setup-dart@v1
26+
with:
27+
sdk: stable
28+
29+
- name: Prepare packages for publishing
30+
run: dart tools/prepare_publish.dart ${{ inputs.version }}
31+
32+
- name: Publish dart_node_react_native
33+
run: |
34+
chmod +x tools/publish_package.sh
35+
./tools/publish_package.sh dart_node_react_native

tools/publish_package.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Publishes a single package to pub.dev
3+
# Usage: ./publish_package.sh <package_name>
4+
5+
PACKAGE=$1
6+
7+
if [ -z "$PACKAGE" ]; then
8+
echo "Usage: ./publish_package.sh <package_name>"
9+
exit 1
10+
fi
11+
12+
cd "$(dirname "$0")/../packages/$PACKAGE" || exit 1
13+
dart pub get
14+
dart pub publish --force

0 commit comments

Comments
 (0)