Skip to content

Commit b1176cd

Browse files
committed
ci: switch pub publish to official dart reusable workflow
1 parent dfa2308 commit b1176cd

1 file changed

Lines changed: 6 additions & 41 deletions

File tree

.github/workflows/publish.yml

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,16 @@
11
name: Publish to pub.dev
22

33
on:
4-
release:
5-
types:
6-
- published
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
77
workflow_dispatch:
88

99
permissions:
1010
contents: read
11-
id-token: write
1211

1312
jobs:
1413
publish:
15-
runs-on: ubuntu-latest
16-
timeout-minutes: 20
17-
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'v')
18-
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v4
21-
22-
- name: Setup Flutter
23-
uses: subosito/flutter-action@v2
24-
with:
25-
channel: stable
26-
cache: true
27-
28-
- name: Verify release tag matches pubspec version
29-
if: github.event_name == 'release'
30-
run: |
31-
version=$(grep '^version:' pubspec.yaml | awk '{print $2}')
32-
if [ "v$version" != "${{ github.event.release.tag_name }}" ]; then
33-
echo "Tag mismatch: pubspec version is v$version but release tag is ${{ github.event.release.tag_name }}"
34-
exit 1
35-
fi
36-
37-
- name: Install dependencies
38-
run: flutter pub get
39-
40-
- name: Verify OIDC is available
41-
run: |
42-
if [ -z "${ACTIONS_ID_TOKEN_REQUEST_URL:-}" ]; then
43-
echo "OIDC token endpoint is not available. Check workflow permissions."
44-
exit 1
45-
fi
46-
47-
- name: Validate package
48-
run: flutter pub publish --dry-run
49-
50-
- name: Publish package
51-
run: timeout 10m flutter pub publish -f
14+
permissions:
15+
id-token: write
16+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1

0 commit comments

Comments
 (0)