Merge pull request #22 from ahmadexe/docs/usage-guide #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to pub.dev | ||
| on: | ||
| push: | ||
| tags: | ||
| - 'agenix-v[0-9]+.[0-9]+.[0-9]+' | ||
| - 'agenix_firebase-v[0-9]+.[0-9]+.[0-9]+' | ||
| jobs: | ||
| guard: | ||
| uses: ./.github/workflows/ci.yml | ||
|
Check failure on line 11 in .github/workflows/publish.yml
|
||
| publish: | ||
| needs: guard | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Set up Flutter | ||
| uses: subosito/flutter-action@v2 | ||
| with: | ||
| channel: stable | ||
| flutter-version: 3.44.3 | ||
| cache: true | ||
| - name: Resolve package + version from tag | ||
| id: pkg | ||
| run: | | ||
| TAG="${GITHUB_REF_NAME}" | ||
| NAME="${TAG%-v*}" | ||
| VER="${TAG##*-v}" | ||
| echo "name=$NAME" >> "$GITHUB_OUTPUT" | ||
| echo "version=$VER" >> "$GITHUB_OUTPUT" | ||
| echo "dir=packages/$NAME" >> "$GITHUB_OUTPUT" | ||
| - name: Install deps | ||
| run: dart pub get | ||
| - name: Verify tag matches pubspec version | ||
| working-directory: ${{ steps.pkg.outputs.dir }} | ||
| run: | | ||
| PUB=$(grep '^version:' pubspec.yaml | awk '{print $2}') | ||
| echo "tag=${{ steps.pkg.outputs.version }} pubspec=$PUB" | ||
| test "${{ steps.pkg.outputs.version }}" = "$PUB" \ | ||
| || { echo "::error::tag != pubspec version"; exit 1; } | ||
| - name: Publish dry-run | ||
| working-directory: ${{ steps.pkg.outputs.dir }} | ||
| run: dart pub publish --dry-run | ||
| - name: Enforce pana score (min 150) | ||
| working-directory: ${{ steps.pkg.outputs.dir }} | ||
| run: | | ||
| dart pub global activate pana | ||
| SCORE=$(dart pub global run pana --no-warning . 2>/dev/null \ | ||
| | grep -oE 'Package scoring: [0-9]+' | grep -oE '[0-9]+') | ||
| echo "Pana score: ${SCORE}/160" | ||
| if [ -z "$SCORE" ]; then echo "::error::no pana score"; exit 1; fi | ||
| if [ "$SCORE" -lt 150 ]; then echo "::error::pana $SCORE < 150"; exit 1; fi | ||
| - name: Publish | ||
| working-directory: ${{ steps.pkg.outputs.dir }} | ||
| run: dart pub publish --force | ||