|
23 | 23 | runs-on: ubuntu-latest |
24 | 24 | permissions: |
25 | 25 | contents: write # Needed to push commits and tags |
| 26 | + id-token: write # Required for OIDC authentication with pub.dev |
26 | 27 |
|
27 | 28 | steps: |
28 | 29 | - uses: actions/checkout@v4 |
@@ -121,31 +122,8 @@ jobs: |
121 | 122 | # git tag "v${{ steps.new_version.outputs.version }}" |
122 | 123 | # git push origin "v${{ steps.new_version.outputs.version }}" |
123 | 124 |
|
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 |
149 | 127 |
|
150 | 128 | - name: Create GitHub Release |
151 | 129 | uses: softprops/action-gh-release@v1 |
|
0 commit comments