Skip to content

added token to workflow #14

added token to workflow

added token to workflow #14

Workflow file for this run

# .github/workflows/publish.yml
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:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for authentication using OIDC
steps:
# Checkout the repo
- name: Checkout repository
uses: actions/checkout@v3
# Set up Flutter
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: '3.24.3'
# Install dependencies
- name: Install dependencies
run: flutter pub get
# Add the pub.dev token to the credentials file
- name: Set up pub.dev token
run: |
mkdir -p ~/.pub-cache
echo '{"accessToken":"${{ secrets.PUBDEV }}","refreshToken":"","tokenEndpoint":"https://accounts.google.com/o/oauth2/token","scopes":["openid","https://www.googleapis.com/auth/userinfo.email"],"expiration":1893456000000}' > ~/.pub-cache/credentials.json
# Publish the package
- name: Publish to pub.dev
run: flutter pub publish --force