Skip to content

Commit 4139f9e

Browse files
authored
ci: Fix auto-release (#1071)
1 parent e67f2fe commit 4139f9e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

.github/workflows/release-publish.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: release-publish
22
on:
3-
workflow_dispatch:
4-
inputs:
5-
tag:
6-
default: ''
7-
description: 'Version tag (dart-#.#.# or flutter-#.#.#):'
3+
push:
4+
tags:
5+
- "dart-[0-9]+.[0-9]+.[0-9]+*"
6+
- "flutter-[0-9]+.[0-9]+.[0-9]+*"
87
workflow_call:
98
inputs:
109
dart_tag:
@@ -16,12 +15,14 @@ on:
1615
type: string
1716
description: 'Flutter package version tag (flutter-#.#.#)'
1817
env:
19-
# Resolve tags for both workflow_dispatch and workflow_call
20-
dart_tag_resolved: ${{ inputs.dart_tag || (startsWith(inputs.tag, 'dart-') && inputs.tag || '') }}
21-
flutter_tag_resolved: ${{ inputs.flutter_tag || (startsWith(inputs.tag, 'flutter-') && inputs.tag || '') }}
18+
# For tag push: extract from github.ref_name
19+
# For workflow_call: use inputs
20+
package: ${{ startsWith(github.ref_name, 'dart-') && 'dart' || startsWith(github.ref_name, 'flutter-') && 'flutter' || '' }}
21+
dart_tag_resolved: ${{ inputs.dart_tag || (startsWith(github.ref_name, 'dart-') && github.ref_name || '') }}
22+
flutter_tag_resolved: ${{ inputs.flutter_tag || (startsWith(github.ref_name, 'flutter-') && github.ref_name || '') }}
2223
jobs:
2324
pub-publish-dart:
24-
if: inputs.dart_tag != '' || startsWith(inputs.tag, 'dart-')
25+
if: inputs.dart_tag != '' || startsWith(github.ref_name, 'dart-')
2526
runs-on: ubuntu-latest
2627
timeout-minutes: 10
2728
permissions:
@@ -49,7 +50,7 @@ jobs:
4950
run: dart pub publish --force
5051

5152
pub-publish-flutter:
52-
if: inputs.flutter_tag != '' || startsWith(inputs.tag, 'flutter-')
53+
if: inputs.flutter_tag != '' || startsWith(github.ref_name, 'flutter-')
5354
runs-on: ubuntu-latest
5455
timeout-minutes: 10
5556
permissions:
@@ -85,7 +86,7 @@ jobs:
8586
run: dart pub publish --force
8687

8788
docs-publish-dart:
88-
if: inputs.dart_tag != '' || startsWith(inputs.tag, 'dart-')
89+
if: inputs.dart_tag != '' || startsWith(github.ref_name, 'dart-')
8990
needs: pub-publish-dart
9091
runs-on: ubuntu-latest
9192
timeout-minutes: 15
@@ -108,7 +109,7 @@ jobs:
108109
destination_dir: dart
109110

110111
docs-publish-flutter:
111-
if: inputs.flutter_tag != '' || startsWith(inputs.tag, 'flutter-')
112+
if: inputs.flutter_tag != '' || startsWith(github.ref_name, 'flutter-')
112113
needs: pub-publish-flutter
113114
runs-on: ubuntu-latest
114115
timeout-minutes: 15

0 commit comments

Comments
 (0)