Skip to content

Commit 40c48c1

Browse files
authored
feat: Auto publish to pub.dev when creating version tag (#312)
* feat: add auto publish to pub.dev when create version tag * refactor: rename file extension
1 parent 14d7d7c commit 40c48c1

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

.github/workflows/dart-ci.yaml renamed to .github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
name: Dart CI
1+
name: Build
22

33
on:
4-
pull_request: { }
4+
pull_request:
5+
types: [opened, synchronize]
56
push:
67
branches:
7-
- 'main'
8+
- "main"
89

910
jobs:
1011
build:
1112
name: Run on ${{ matrix.os }}
1213
runs-on: ${{ matrix.os }}
1314
strategy:
1415
matrix:
15-
os: [ ubuntu-latest, windows-latest, macos-latest ]
16+
os: [ubuntu-latest, windows-latest, macos-latest]
1617
steps:
1718
- uses: actions/checkout@v3
1819
- uses: subosito/flutter-action@v2
@@ -35,7 +36,7 @@ jobs:
3536
run: |
3637
dart pub global activate melos
3738
melos bootstrap
38-
39+
3940
- name: Get dependencies for Windows
4041
if: startsWith(matrix.os, 'windows')
4142
run: |

.github/workflows/release.yaml renamed to .github/workflows/release.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,25 @@ jobs:
6565
name: sha256
6666
path: packages/command/bin/${{ matrix.target }}/fluttergen-${{ matrix.artifact_prefix }}.sha256
6767

68+
- name: setup credentials
69+
run: |
70+
mkdir -p ~/.pub-cache
71+
cat <<eof > ~/.pub-cache/credentials.json
72+
{
73+
"accesstoken":"${{ secrets.CREDENTIALS_ACCESS_TOKEN }}",
74+
"refreshtoken":"${{ secrets.CREDENTIALS_REFRESH_TOKEN }}",
75+
"idtoken":"${{ secrets.CREDENTIALS_ID_TOKEN }}",
76+
"tokenendpoint":"https://accounts.google.com/o/oauth2/token",
77+
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
78+
"expiration": 1664440281637
79+
}
80+
eof
81+
82+
- name: publish to pub.dev
83+
run: |
84+
melos publish | echo y
85+
melos publish --no-dry-run | echo y
86+
6887
update:
6988
runs-on: ubuntu-latest
7089
needs: build
@@ -87,20 +106,3 @@ jobs:
87106
repository: FlutterGen/homebrew-tap
88107
event-type: update-tap
89108
client-payload: '{ "sha256_linux": "${{ steps.checksum.outputs.sha256_linux }}", "sha256_macos": "${{ steps.checksum.outputs.sha256_macos }}", "version": "${{ steps.version.outputs.version }}" }'
90-
91-
# publish:
92-
# name: Publishing
93-
# runs-on: ubuntu-latest
94-
#
95-
# steps:
96-
# - name: Checking out sources
97-
# uses: actions/checkout@v2
98-
#
99-
# - name: Publish to pub.dev
100-
# uses: sakebook/[email protected]
101-
# with:
102-
# credential: ${{ secrets.CREDENTIAL_JSON }}
103-
# flutter_package: false
104-
# skip_test: true
105-
# dry_run: false
106-

0 commit comments

Comments
 (0)