-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.36 KB
/
publish_package.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
52
name: Publish Flutter Package
on:
pull_request:
types: [closed]
branches:
- main
jobs:
publish:
if: github.event.pull_request.merged == true
name: Publish Package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: widgets
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.0'
- name: Get branch name
id: get_branch
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> $GITHUB_ENV
- name: Install dependencies
run: |
echo "Branch name: ${{ env.BRANCH_NAME }}"
cd widgets/${{ env.BRANCH_NAME }}
flutter pub get
- name: Setup Pub Credentials
shell: bash
env:
PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ REFRESH_TOKEN }}
PUB_DEV_PUBLISH_TOKEN_ENDPOINT: ${{ secrets.PUB_DEV_PUBLISH_TOKEN_ENDPOINT }}
PUB_DEV_PUBLISH_EXPIRATION: ${{ secrets.EXPIRATION }}
run: |
sh ./pub_login.sh
- name: Publish package
env:
PUB_TOKEN: ${{ secrets.CREDENTIAL_JSON }}
run: |
cd widgets/${{ env.BRANCH_NAME }}
flutter pub publish --dry-run
flutter pub publish --force