-
Notifications
You must be signed in to change notification settings - Fork 10
51 lines (43 loc) · 1.53 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
48
49
50
51
name: Publish Package
on:
release:
types: [published]
env:
FLUTTER_CHANNEL: 'stable'
FLUTTER_VERSION: '3.24.4'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install dependencies
run: flutter pub get
- name: Setup pub.dev credentials
run: |
mkdir -p ${{ runner.workspace }}/.config/dart
echo "$CREDENTIAL_JSON" > ${{ runner.workspace }}/.config/dart/pub-credentials.json
if [ -n "$XDG_CONFIG_HOME" ]; then
mkdir -p $XDG_CONFIG_HOME/dart
cp ${{ runner.workspace }}/.config/dart/pub-credentials.json $XDG_CONFIG_HOME/dart/pub-credentials.json
else
mkdir -p $HOME/.config/dart
cp ${{ runner.workspace }}/.config/dart/pub-credentials.json $HOME/.config/dart/pub-credentials.json
fi
env:
CREDENTIAL_JSON: ${{ secrets.CREDENTIAL_JSON }}
XDG_CONFIG_HOME: ${{ env.XDG_CONFIG_HOME }}
- name: Publish to pub.dev
run: dart pub publish -f
- name: Create release branch
uses: peterjgrainger/[email protected]
with:
branch: release/${{ github.event.release.tag_name }}
sha: '${{ github.event.pull_request.head.sha }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}