Skip to content

Commit 6e3b4a9

Browse files
committed
ci: split out publishing workflow
1 parent 52b8389 commit 6e3b4a9

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

.github/workflows/cd.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
name: Publish to Pub.dev & Github
1+
# For Flutter publish, a tag must be created first so we create a Github Release
2+
# Then this should trigger the publish to Pub.dev workflow
3+
name: Publish to Github
24
on:
35
workflow_dispatch:
46
pull_request:
@@ -8,10 +10,6 @@ on:
810
- main
911
- rel/**
1012

11-
permissions:
12-
id-token: write # Required for authentication using OIDC
13-
contents: write
14-
1513
jobs:
1614
publish:
1715
if: |
@@ -25,24 +23,13 @@ jobs:
2523
- name: Checkout
2624
uses: actions/checkout@v5
2725

28-
- name: Set up Flutter
29-
uses: ./.github/actions/setup-flutter
30-
31-
# This step is what enables Dart's OIDC "trusted publishing" wiring.
32-
# Even though you publish with flutter, OIDC creds are handled via Dart tooling.
33-
- uses: dart-lang/setup-dart@v1
34-
3526
- name: Get version from pubspec.yaml
3627
id: version
3728
run: |
3829
VERSION=$(grep "^version:" pubspec.yaml | sed 's/version: //' | tr -d ' ')
3930
echo "version=$VERSION" >> $GITHUB_OUTPUT
4031
echo "Version: $VERSION"
4132
42-
- name: Publish to Pub.dev
43-
run: |
44-
flutter pub publish --force
45-
4633
create-release:
4734
needs: publish
4835
uses: OneSignal/sdk-actions/.github/workflows/github-release.yml@main

.github/workflows/publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# OIDC published for pub.dev
2+
# Reference: https://dart.dev/tools/pub/automated-publishing
3+
name: Publish to pub.dev
4+
5+
on:
6+
push:
7+
tags:
8+
# must align with the tag-pattern configured on pub.dev, often just replace
9+
# {{version}} with [0-9]+.[0-9]+.[0-9]+
10+
- "[0-9]+.[0-9]+.[0-9]+" # tag-pattern on pub.dev: '{{version}}'
11+
12+
# Publish using the reusable workflow from dart-lang.
13+
jobs:
14+
publish:
15+
permissions:
16+
id-token: write # Required for authentication using OIDC
17+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1

0 commit comments

Comments
 (0)