* format #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to pub.dev | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' # tag-pattern on pub.dev: 'v{{1.0.0}}' | |
permissions: | |
id-token: write | |
# Publish using custom workflow | |
jobs: | |
publish: | |
name: Publish | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.0' | |
channel: 'stable' | |
cache: true | |
- name: Flutter dependencies | |
run: flutter pub get | |
- name: Create publishing token | |
run: | | |
set -eo pipefail | |
PUB_TOKEN=$(curl --retry 5 --retry-connrefused -sLS "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=https://pub.dev" -H "User-Agent: actions/oidc-client" -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" | jq -r '.value') | |
echo "PUB_TOKEN=${PUB_TOKEN}" >> $GITHUB_ENV | |
export PUB_TOKEN | |
flutter pub token add https://pub.dev --env-var PUB_TOKEN | |
- name: Publish - dry run | |
run: flutter pub publish --dry-run | |
- name: Publish to pub.dev | |
run: flutter pub publish -f |