Modify patrol-publish.yaml to check semver before publishing #4
Workflow file for this run
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: Check semver | |
on: | |
workflow_dispatch: | |
pull_request: | |
jobs: | |
get_last_released_version: | |
name: Get last released version | |
runs-on: ubuntu-latest | |
outputs: | |
last_version: ${{ steps.get_last_released_version.outputs.last_version }} | |
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 | |
echo "last_version=$last_version" >> $GITHUB_ENV | |
echo "::set-output name=last_version::$last_version" | |
semver: | |
name: Check API changes | |
runs-on: ubuntu-latest | |
needs: [get_last_released_version] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Set up Dart | |
uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: stable | |
- name: Install dart-apitool | |
run: dart pub global activate dart_apitool | |
- name: Check API changes | |
run: dart-apitool diff \ | |
--old pub://patrol/${{ needs.get_last_released_version.outputs.last_version }} \ | |
--new packages/patrol | |
report: | |
name: Report success | |
runs-on: ubuntu-latest | |
needs: [get_last_released_version, semver] | |
steps: | |
- name: Print success | |
run: echo "Success" |