Skip to content

Commit 93b668d

Browse files
committed
Switch to OIDC
1 parent c5046a0 commit 93b668d

File tree

1 file changed

+3
-25
lines changed

1 file changed

+3
-25
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
permissions:
2525
contents: write # Needed to push commits and tags
26+
id-token: write # Required for OIDC authentication with pub.dev
2627

2728
steps:
2829
- uses: actions/checkout@v4
@@ -121,31 +122,8 @@ jobs:
121122
# git tag "v${{ steps.new_version.outputs.version }}"
122123
# git push origin "v${{ steps.new_version.outputs.version }}"
123124

124-
- name: Setup credentials and Publish to pub.dev 🚀
125-
shell: bash
126-
run: |
127-
# 1. Define the PUB_CACHE location and ensure it's exported for all sub-commands.
128-
# Use the GITHUB_ENV file to set the variable for subsequent steps,
129-
# but export it immediately for use in this step.
130-
export PUB_CACHE="${{ runner.temp }}/.pub-cache"
131-
echo "PUB_CACHE=${PUB_CACHE}" >> $GITHUB_ENV
132-
133-
# 2. Create the necessary directory structure
134-
mkdir -p "$PUB_CACHE"
135-
136-
# 3. Write the credentials.json file
137-
CREDENTIALS_PATH="$PUB_CACHE/credentials.json"
138-
echo "Writing credentials to $CREDENTIALS_PATH"
139-
cat <<EOF > "$CREDENTIALS_PATH"
140-
${{ secrets.PUB_CREDENTIALS }}
141-
EOF
142-
143-
# 4. Verify the file was written (Optional sanity check)
144-
ls -la "$PUB_CACHE"
145-
146-
# 5. Publish using the configured PUB_CACHE
147-
echo "Attempting to publish..."
148-
dart pub publish --force
125+
- name: Publish to pub.dev
126+
run: dart pub publish --force
149127

150128
- name: Create GitHub Release
151129
uses: softprops/action-gh-release@v1

0 commit comments

Comments
 (0)