Update dart.yml #17
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: Dart 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 Dart | |
uses: nikosportolos/dart_package@v0.2.1 | |
with: | |
sdk: 'stable' | |
- name: Install dependencies | |
run: dart pub get | |
- name: Run tests | |
run: dart test | |
- name: Publish to pub.dev (dry run) | |
env: | |
PUB_DEV_TOKEN: ${{ secrets.PUBDEV_TOKEN }} | |
run: dart pub publish --dry-run | |
- name: Publish to pub.dev | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
env: | |
PUB_DEV_TOKEN: ${{ secrets.PUBDEV_TOKEN }} | |
run: dart pub publish --force |