chore: use oidc instead of a session token to publish to pub
This commit is contained in:
parent
7d4c9dd916
commit
43a5bc7d92
|
|
@ -76,23 +76,3 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
dart pub get
|
dart pub get
|
||||||
dart pub publish --dry-run
|
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
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in New Issue