Skip to content

patrol publish

patrol publish #139

Workflow file for this run

name: patrol publish
on:
push:
tags: ['patrol-v*']
jobs:
publish:
name: Publish on pub.dev
runs-on: ubuntu-latest
outputs:
package_name: ${{ steps.pub_release.outputs.package_name }}
package_version: ${{ steps.pub_release.outputs.package_version }}
changelog_url: ${{ steps.pub_release.outputs.changelog_url }}
prerelease: ${{ steps.pub_release.outputs.prerelease }}
permissions:
id-token: write
contents: write
strategy:
matrix:
flutter-version: ['3.22.x']
flutter-channel: ['stable']
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get last released version
id: get_last_released_version
run: |
last_version=$(git tag --list 'patrol-v*' | grep -v '\-dev\.[0-9]\+$' | sort -V | tail -n 1 | sed 's/^patrol-v//')
echo "last_version=$last_version" >> $GITHUB_ENV
echo "::set-output name=last_version::$last_version"
# This step adds the auth token for pub.dev
- name: Set up Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ matrix.flutter-version }}
channel: ${{ matrix.flutter-channel }}
- name: Install dart-apitool
run: dart pub global activate dart_apitool
- name: Check API changes
run: |
dart-apitool diff \
--old pub://patrol/${{ steps.get_last_released_version.outputs.last_version }} \
--new packages/patrol
- name: Build DevTools extension
working-directory: packages/patrol_devtools_extension
run: ./publish_to_patrol_extension
- name: Verify that built DevTools extension is in the correct location
working-directory: packages/patrol
run: test ! -z "$(ls -lA extension/devtools/build)"
- name: Publish to pub.dev
id: pub_release
uses: leancodepl/mobile-tools/.github/actions/pub-release@pub-release-v1
with:
path: packages/patrol
notify:
name: Notify on Slack
runs-on: ubuntu-latest
needs: publish
if: needs.publish.outputs.prerelease == 'false'
steps:
- name: Share test results on Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ${{ vars.SLACK_RELEASES_CHANNEL }}
SLACK_USERNAME: Patrol CI on GitHub Actions
SLACK_ICON: ${{ vars.SLACK_ICON }}
SLACK_TITLE: New ${{ needs.publish.outputs.package_name }} version
SLACK_MESSAGE: |
${{ needs.publish.outputs.package_name }} ${{ needs.publish.outputs.package_version }} has been released 🎉
See release notes <${{ needs.publish.outputs.changelog_url }}|here>