Skip to content

Commit 223777f

Browse files
authored
Merge pull request #73 from talkjs/chore/github_action_publishing
(Chore): GitHub action publishing
2 parents ac32fd2 + dc16024 commit 223777f

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: Publish to Pub.dev
42

5-
# Controls when the workflow will run
63
on:
7-
## Triggers the workflow on push or pull request events but only for the main branch
8-
#push:
9-
# branches: [ main ]
10-
#pull_request:
11-
# branches: [ main ]
12-
13-
# Allows you to run this workflow manually from the Actions tab
14-
workflow_dispatch:
4+
push:
5+
tags:
6+
# must align with the tag-pattern configured on pub.dev
7+
# tag-pattern on pub.dev: 'v{{version}}'
8+
# where {{version}} is identical to what we have in pubspec.yaml
9+
- "v[0-9]+.[0-9]+.[0-9]+"
1510

16-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1711
jobs:
1812
publishing:
19-
# The type of runner that the job will run on
2013
runs-on: ubuntu-latest
2114

22-
# Steps represent a sequence of tasks that will be executed as part of the job
15+
permissions:
16+
id-token: write # Required for authentication using OIDC
17+
18+
environment: pub.dev
19+
2320
steps:
24-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
25-
- name: 'Checkout'
26-
uses: actions/checkout@v2 # required!
21+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
2722

28-
- name: 'Update version string'
23+
- name: Setup Dart SDK and provision OIDC token
24+
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c #v1.7.1
25+
26+
- name: Setup Flutter SDK - needed for publishing Flutter packages.
27+
uses: flutter-actions/setup-flutter@6d11b83d56c388d0b6fe865194248a01a48548b5 #v4.1
28+
29+
- name: Update version string
2930
run: yq '.version' pubspec.yaml > lib/assets/version.txt
3031

31-
- name: '>> Dart package <<'
32-
uses: k-paxian/dart-package-publisher@master
33-
with:
34-
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
35-
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
36-
flutter: true
32+
- name: Install dependencies
33+
run: dart pub get
34+
35+
- name: Publish (Dry run)
36+
run: dart pub publish --dry-run
3737

38+
# If the package has errors, it won't upload.
39+
- name: Publish
40+
run: dart pub publish --force

0 commit comments

Comments
 (0)