Skip to content

Publish to Pub.dev

Publish to Pub.dev #34

Workflow file for this run

name: Publish to Pub.dev
on:
push:
tags:
# must align with the tag-pattern configured on pub.dev
# tag-pattern on pub.dev: 'v{{version}}'
# where {{version}} is identical to what we have in pubspec.yaml
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
publishing:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for authentication using OIDC
environment: pub.dev
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
- name: Setup Dart SDK and provision OIDC token
uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c #v1.7.1
- name: Setup Flutter SDK - needed for publishing Flutter packages.
uses: flutter-actions/setup-flutter@6d11b83d56c388d0b6fe865194248a01a48548b5 #v4.1
# Previously dart would publish just fine after updating versin.txt in the below step.
# Now it throws the error: "Package validation found the following potential issue: * 1 checked-in file is modified in git."
#
# - name: Update version string
# run: yq '.version' pubspec.yaml > lib/assets/version.txt
- name: Install dependencies
run: dart pub get
- name: Publish (Dry run)
run: dart pub publish --dry-run
# If the package has errors, it won't upload.
- name: Publish
run: dart pub publish --force