Skip to content

Commit

Permalink
test and publish action added
Browse files Browse the repository at this point in the history
  • Loading branch information
BerkSartik committed Aug 18, 2023
1 parent 6573c58 commit 3a14796
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test and Publish to pub.dev
run-name: Test and Publish action triggered by @${{ github.actor }}

on:
release:
types: [published]
# "workflow_dispatch" for manual trigger
workflow_dispatch:

jobs:
test-before-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: Install Flutter(Stable)
uses: subosito/flutter-action@master
with:
channel: "stable"
- name: Install Dependencies
run: flutter pub get
- name: Analyze the Repository
run: flutter analyze lib example/lib
- name: Run All Tests
run: flutter test
- name: Check Publish Warnings
run: dart pub publish --dry-run

publish:
# if test is successful it will be published on pub.dev
needs: test-before-publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: Publish to Pub.dev
uses: k-paxian/dart-package-publisher@master
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
credentialJson: ${{ secrets.CREDENTIAL_JSON }}
flutter: true
skipTests: true

0 comments on commit 3a14796

Please sign in to comment.