diff --git a/.github/workflows/publish-insforge-flutter.yml b/.github/workflows/publish-insforge-flutter.yml index ddc9f8b..5cddf81 100644 --- a/.github/workflows/publish-insforge-flutter.yml +++ b/.github/workflows/publish-insforge-flutter.yml @@ -17,6 +17,8 @@ jobs: stable: ${{ steps.version.outputs.stable }} steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 + with: + fetch-depth: 0 - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 @@ -34,6 +36,11 @@ jobs: echo "version=$version" >> "$GITHUB_OUTPUT" if [[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then echo "stable=true" >> "$GITHUB_OUTPUT" + release_commit="$(git rev-parse "${RELEASE_TAG}^{commit}")" + if ! git merge-base --is-ancestor "$release_commit" origin/main; then + echo "Stable release $RELEASE_TAG must point to a commit contained in main." >&2 + exit 1 + fi else echo "stable=false" >> "$GITHUB_OUTPUT" fi diff --git a/.github/workflows/publish-insforge.yml b/.github/workflows/publish-insforge.yml index 9869bba..83cf6de 100644 --- a/.github/workflows/publish-insforge.yml +++ b/.github/workflows/publish-insforge.yml @@ -17,6 +17,8 @@ jobs: stable: ${{ steps.version.outputs.stable }} steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 + with: + fetch-depth: 0 - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 @@ -33,6 +35,11 @@ jobs: if [[ "$version" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then echo "stable=true" >> "$GITHUB_OUTPUT" + release_commit="$(git rev-parse "${RELEASE_TAG}^{commit}")" + if ! git merge-base --is-ancestor "$release_commit" origin/main; then + echo "Stable release $RELEASE_TAG must point to a commit contained in main." >&2 + exit 1 + fi else echo "stable=false" >> "$GITHUB_OUTPUT" fi