Fixes #40
Workflow file for this run
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: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| jobs: | |
| deploy-dart: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: flutter-actions/setup-flutter@v4 | |
| with: | |
| channel: stable | |
| version: 3.38.8 | |
| cache: true | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Run checks | |
| run: flutter analyze | |
| - name: Dry run | |
| run: flutter pub publish --dry-run | |
| - name: Publish to pub.dev | |
| uses: dart-lang/setup-dart@v1 | |
| with: | |
| sdk: stable | |
| - name: Publish to pub.dev | |
| run: flutter pub publish --force | |
| - name: Rename tag when fails | |
| if: failure() | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| TIMESTAMP=$(date +%Y%m%d-%H%M%S) | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| NEW_TAG="failed-${TAG_NAME}-${TIMESTAMP}" | |
| git tag $NEW_TAG | |
| git push origin $NEW_TAG | |
| git push --delete origin $TAG_NAME | |
| - name: Create GitHub Release | |
| if: success() | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |