Skip to content

Commit

Permalink
add auto publish on pub.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaGiorgadze committed Feb 14, 2023
1 parent 03c4d63 commit 79a210d
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
name: Publish Package
name: Publish to pub.dev

on:
push:
branches:
- "release/**"
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*' # tag pattern on pub.dev: 'v'

# Publish using custom workflow
jobs:
build:
publish:
permissions:
id-token: write # This is required for authentication using OIDC
runs-on: ubuntu-latest
container:
image: dart:latest
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- name: Install dependencies
run: dart pub get
- name: Run tests
run: dart pub run test
- name: Setup credentials
run: |
mkdir -p ~/.pub-cache
cat <<EOF > ~/.pub-cache/credentials.json
{
"accessToken":"${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }}",
"refreshToken":"${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }}",
"tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
"expiration": ${{ secrets.PUB_DEV_PUBLISH_EXPIRATION }}
}
EOF
- name: Publish package
run: dart pub publish -f
# Here you can insert custom steps you need
# - run: dart tool/generate-code.dart
- name: Publish
run: dart pub publish --force

0 comments on commit 79a210d

Please sign in to comment.