Update dart.yml #25
This file contains 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: Flutter Package | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: 3.22.2 | |
- name: Install dependencies | |
run: flutter pub get | |
# - name: Run tests | |
# run: flutter test | |
- name: Create credentials.json | |
env: | |
PUBDEV_TOKEN: ${{ secrets.PUBDEV_TOKEN }} | |
run: | | |
mkdir -p ~/.pub-cache | |
echo "$PUBDEV_TOKEN" > ~/.pub-cache/credentials.json | |
cat ~/.pub-cache/credentials.json # Add debugging to ensure the file is created correctly | |
ls -la ~/.pub-cache # List contents of the directory for debugging | |
- name: Publish to pub.dev (dry run) | |
run: flutter pub publish --dry-run | |
- name: Publish to pub.dev | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: flutter pub publish --force |