Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check tag exists on main on release #250

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .github/workflows/java-build-for-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,34 @@ on:
# if you change this pattern, make sure jobs.strip-tag still works
- 'release/java/v[0-9]+.[0-9]+.[0-9]+'
jobs:
check-tag-main:
runs-on: ubuntu-latest
steps:
- name: Checkout all branches
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Verify tag on branch
# Check main is one of the branches where the tagged commit exists
run: |
branches=($(git branch --contains ${{ github.ref }} --format "%(refname:short)"))
found=false
for b in "${branches[@]}"; do
if [ "$b" = "main" ]; then
found=true
fi
done
if [ "$found" = false ]; then
exit 1
fi

ci:
needs: [check-tag-main]
uses: ./.github/workflows/java-build.yml

strip-tag:
needs: [check-tag-main]
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
Expand All @@ -21,7 +45,7 @@ jobs:

build:
runs-on: ubuntu-latest
needs: [ci, strip-tag]
needs: [ci, strip-tag, check-tag-main]
outputs:
hashes: ${{ steps.hash.outputs.hashes }}
steps:
Expand Down