-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (46 loc) · 1.47 KB
/
Copy pathpublish.yml
File metadata and controls
55 lines (46 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Publish to pub.dev
on:
push:
tags:
- 'agenix-v[0-9]+.[0-9]+.[0-9]+'
- 'agenix_firebase-v[0-9]+.[0-9]+.[0-9]+'
jobs:
guard:
uses: ./.github/workflows/ci.yml
publish:
needs: guard
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v7
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.44.3
cache: true
- name: Resolve package + version from tag
id: pkg
run: |
TAG="${GITHUB_REF_NAME}"
NAME="${TAG%-v*}"
VER="${TAG##*-v}"
echo "name=$NAME" >> "$GITHUB_OUTPUT"
echo "version=$VER" >> "$GITHUB_OUTPUT"
echo "dir=packages/$NAME" >> "$GITHUB_OUTPUT"
- name: Install deps
run: dart pub get
- name: Verify tag matches pubspec version
working-directory: ${{ steps.pkg.outputs.dir }}
run: |
PUB=$(grep '^version:' pubspec.yaml | awk '{print $2}')
echo "tag=${{ steps.pkg.outputs.version }} pubspec=$PUB"
test "${{ steps.pkg.outputs.version }}" = "$PUB" \
|| { echo "::error::tag != pubspec version"; exit 1; }
- name: Publish dry-run
working-directory: ${{ steps.pkg.outputs.dir }}
run: dart pub publish --dry-run
- name: Publish
working-directory: ${{ steps.pkg.outputs.dir }}
run: dart pub publish --force