Skip to content

Commit 5f5bdbe

Browse files
committed
Simplify pub.dev publishing workflow using official action
Replace custom publishing implementation with dart-lang/setup-dart's reusable workflow. This removes the need for manual credential management and version checking while adding proper semver tag filtering.
1 parent 805df14 commit 5f5bdbe

2 files changed

Lines changed: 5 additions & 49 deletions

File tree

.github/workflows/publish-on-pub.yaml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,9 @@ name: Publish package to pub.dev
22
on:
33
push:
44
tags:
5-
- v*
5+
- 'v[0-9]+.[0-9]+.[0-9]+*'
66
jobs:
7-
build:
8-
runs-on: ubuntu-latest
9-
steps:
10-
- uses: actions/checkout@v4
11-
- uses: subosito/flutter-action@v2
12-
with:
13-
channel: 'stable'
14-
- run: flutter pub get
15-
- run: flutter pub run tool/publish/check_version.dart ${GITHUB_REF}
16-
- name: Setup credentials
17-
run: |
18-
mkdir -p $XDG_CONFIG_HOME/dart
19-
cat <<EOF > $XDG_CONFIG_HOME/dart/pub-credentials.json
20-
{
21-
"accessToken":"${{ secrets.OAUTH_ACCESS_TOKEN }}",
22-
"refreshToken":"${{ secrets.OAUTH_REFRESH_TOKEN }}",
23-
"tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
24-
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
25-
"expiration": 1691492965565
26-
}
27-
EOF
28-
- name: Publish package
29-
run: flutter pub publish --force
7+
publish:
8+
permissions:
9+
id-token: write
10+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1

tool/publish/check_version.dart

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

0 commit comments

Comments
 (0)