|
1 | | -name: Dart CI |
| 1 | +name: Publish to pub.dev |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | tags: |
6 | | - - 'v*.*.*' |
| 6 | + - 'v[0-9]+.[0-9]+.[0-9]+' # Tag pattern to match for publishing |
| 7 | + |
| 8 | +permissions: # Job-level permissions |
| 9 | + contents: read # For actions/checkout |
| 10 | + # id-token: write # Not strictly needed when using PUB_ACCESS_TOKEN/PUB_REFRESH_TOKEN directly |
7 | 11 |
|
8 | 12 | jobs: |
9 | | - build: |
10 | | - name: Run on ${{ matrix.os }} |
11 | | - runs-on: ${{ matrix.os }} |
12 | | - strategy: |
13 | | - matrix: |
14 | | - os: [ubuntu-latest] |
| 13 | + publish: |
| 14 | + runs-on: ubuntu-latest |
15 | 15 | steps: |
16 | | - - uses: actions/checkout@v4 |
17 | | - - uses: subosito/flutter-action@v2 |
18 | | - with: |
19 | | - channel: stable |
20 | | - - uses: dart-lang/setup-dart@v1 |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Import .tool-versions |
| 20 | + uses: wasabeef/import-asdf-tool-versions-action@v1.1.0 |
| 21 | + id: asdf |
| 22 | + |
| 23 | + - name: Setup Flutter |
| 24 | + uses: subosito/flutter-action@v2 |
21 | 25 | with: |
22 | | - sdk: stable |
| 26 | + flutter-version: ${{ steps.asdf.outputs.flutter }} |
| 27 | + cache: true |
| 28 | + |
| 29 | + - name: Activate Melos |
| 30 | + run: dart pub global activate melos |
| 31 | + |
| 32 | + - name: Get Melos packages |
| 33 | + run: melos get |
23 | 34 |
|
24 | | - - name: Set environment |
25 | | - run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH |
| 35 | + - name: Publish packages with Melos |
| 36 | + run: melos publish --no-dry-run --yes |
26 | 37 |
|
27 | | - - name: Get dependencies |
28 | | - run: | |
29 | | - dart pub global activate melos |
30 | | - melos run get |
31 | | - - name: Release |
32 | | - uses: softprops/action-gh-release@v2 |
| 38 | + - name: Create GitHub Release |
| 39 | + uses: softprops/action-gh-release@v2 # Consider using a more recent version |
| 40 | + if: startsWith(github.ref, 'refs/tags/') |
| 41 | + env: |
| 42 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments