11# Publish new releases to Bazel Central Registry.
22name : Publish to BCR
33on :
4- # For now, the workflow must be manually triggered.
4+ # Manual trigger
55 workflow_dispatch :
66 inputs :
77 tag_name :
88 description : git tag being released
99 required : true
1010 type : string
11+
12+ # Automated trigger on git tag push
13+ push :
14+ tags :
15+ # Glob pattern: branch_semver-postfix
16+ - ' sdformat[1-9]?[0-9]_[0-9]+.[0-9]+.[0-9]+*'
1117jobs :
1218 # The publish-to-bcr reusable workflow expects the version name to be in
1319 # semver-(optional build metadata postfix) format, but the repo tags are in
@@ -17,23 +23,31 @@ jobs:
1723 runs-on : ubuntu-latest
1824 outputs :
1925 prefix : ${{ steps.extract.outputs.prefix }}
26+ tag_name : ${{ steps.extract.outputs.tag_name }}
2027 steps :
21- - name : Extract the tag prefix from the tag name.
28+ - name : Determine tag name and prefix
2229 id : extract
2330 run : |
24- branch=$(echo "${{ inputs.tag_name }}" | cut -d'_' -f1)
31+ # Use input if manual, otherwise use the ref_name from the push event
32+ TAG_NAME="${{ inputs.tag_name || github.ref_name }}"
33+
34+ # Extract prefix (everything before the underscore)
35+ branch=$(echo "$TAG_NAME" | cut -d'_' -f1)
2536 prefix="${branch}_"
26- echo "prefix=${prefix}" | tee -a "$GITHUB_OUTPUT"
37+
38+ echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
39+ echo "prefix=$prefix" >> "$GITHUB_OUTPUT"
2740
2841 publish :
2942 needs : extract_tag_prefix
3043 uses : bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v1.0.0
3144 with :
32- tag_name : ${{ inputs .tag_name }}
45+ tag_name : ${{ needs.extract_tag_prefix.outputs .tag_name }}
3346 # GitHub repository which is a fork of the upstream where the Pull Request will be opened.
3447 registry_fork : gazebo-forks/bazel-central-registry
3548 attest : false
3649 tag_prefix : ${{ needs.extract_tag_prefix.outputs.prefix }}
50+ draft : false
3751
3852 permissions :
3953 attestations : write
0 commit comments