forked from kin-labs/kinetic-dart-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (39 loc) · 1.18 KB
/
dart.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
48
49
50
51
name: Flutter Package
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.22.2
- name: Install dependencies
run: flutter pub get
# - name: Run tests
# run: flutter test
- name: Create credentials.json
env:
PUBDEV_TOKEN: ${{ secrets.PUBDEV_TOKEN }}
run: |
# Set the configuration path
CONFIG_PATH="${XDG_CONFIG_HOME:-$HOME/.config}/dart"
# Ensure the directory exists
mkdir -p "$CONFIG_PATH"
# Write the credentials to the appropriate location
echo "$PUBDEV_TOKEN" > "$CONFIG_PATH/pub-credentials.json"
# Verify the file was created correctly
cat "$CONFIG_PATH/pub-credentials.json"
- name: Publish to pub.dev (dry run)
run: flutter pub publish --dry-run
- name: Publish to pub.dev
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: flutter pub publish --force