chore: use oidc instead of a session token to publish to pub

This commit is contained in:
td 2023-07-19 21:39:48 +05:30
parent 7d4c9dd916
commit 43a5bc7d92
No known key found for this signature in database
GPG Key ID: F6D9E9BF14C7D103
2 changed files with 15 additions and 20 deletions

View File

@ -76,23 +76,3 @@ jobs:
run: |
dart pub get
dart pub publish --dry-run
pub-dev:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
container:
image: dart:${{inputs.dart_version}}
steps:
- uses: actions/checkout@v3
- name: pub.dev publish
run: |
if [ -z "${{ secrets.PUB_DEV_CREDENTIALS }}" ]; then
echo "Missing PUB_DEV_CREDENTIALS environment variable"
exit 1
fi
mkdir -p ~/.config/dart/
cp "${{ secrets.PUB_DEV_CREDENTIALS }}" ~/.config/dart/pub-credentials.json
dart pub get
dart pub publish --force

15
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: Publish to pub.dev
on:
push:
tags:
- 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
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
environment: pub.dev