Merge pull request #158 from cadivus/publish_pipeline #1
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: | |
# must align with the tag-pattern configured on pub.dev, often just replace | |
# with [0-9]+.[0-9]+.[0-9]+* | |
- 'v[0-9]+.[0-9]+.[0-9]+*' # tag-pattern on pub.dev: 'v' | |
# If you prefer tags like '1.2.3', without the 'v' prefix, then use: | |
# - '[0-9]+.[0-9]+.[0-9]+*' # tag-pattern on pub.dev: '' | |
# If your repository contains multiple packages consider a pattern like: | |
# - 'my_package_name-v[0-9]+.[0-9]+.[0-9]+*' | |
# Publish using the reusable workflow from dart-lang. | |
jobs: | |
publish: | |
permissions: | |
id-token: write # Required for authentication using OIDC | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
- run: flutter pub get | |
- name: Create publishing token (flutter) | |
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 | |
- run: flutter pub publish --force # Ignore warnings |