-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (39 loc) · 1.16 KB
/
publish.yml
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
name: Publish to pub.dev
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
jobs:
main:
permissions:
id-token: write
runs-on: ubuntu-latest
environment: pub.dev
steps:
- uses: actions/checkout@v3
- name: Replace version number in flutter/pubspec.yaml
run: |
tag=${{ github.ref_name }}
version=$(echo $tag | sed 's/^v//')
sed -i -r "s/version: [0-9]+\.[0-9]+\.[0-9]+*/version: $version/g" pubspec.yaml
# This action adds a token needed for pub.dev
- name: Install Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
architecture: x64
- name: Install dependencies
run: flutter pub get
- name: Run tests
run: |
flutter analyze
# flutter test
- name: Publish to pub.dev
run: flutter pub publish --force