File tree Expand file tree Collapse file tree 2 files changed +25
-5
lines changed
Expand file tree Collapse file tree 2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change 6767 images : ${{ inputs.image }}
6868 tags : |
6969 type=raw,value=latest
70- type=sha,format=short ,prefix=
70+ type=sha,format=long ,prefix=
7171 ${{ inputs.tag_with_version && format('type=raw,value=v{0}', inputs.version) || '' }}
7272
7373 - name : Build and Push Image
8585 run : |
8686 IMAGE="${{ inputs.image }}"
8787 NAME="${IMAGE##*/}"
88- SHORT_SHA="${GITHUB_SHA::7}"
89- TAGS="latest, ${SHORT_SHA}"
88+ # Derive SHA from the checked-out ref to ensure correctness.
89+ FULL_SHA=$(git rev-parse HEAD)
90+ TAGS="latest, ${FULL_SHA}"
9091 if [ "${{ inputs.tag_with_version }}" = "true" ] && [ -n "${{ inputs.version }}" ]; then
9192 TAGS="${TAGS}, v${{ inputs.version }}"
9293 fi
Original file line number Diff line number Diff line change 1515 - minor
1616 - major
1717 default : patch
18+ release :
19+ description : " Manual release version (e.g. 1.2.3). Overrides bump."
20+ type : string
21+ required : false
22+ default : " "
1823
1924permissions :
2025 contents : write
3843 - name : Install cargo-edit
3944 run : cargo install cargo-edit --locked
4045
41- - name : Bump Workspace Versions
46+ - name : Set Workspace Version (manual or bump)
47+ shell : bash
4248 run : |
43- cargo set-version --workspace --bump "${{ inputs.bump }}"
49+ set -euo pipefail
50+ MANUAL_RELEASE="${{ inputs.release }}"
51+ if [[ -n "${MANUAL_RELEASE}" ]]; then
52+ # Validate SemVer (strict X.Y.Z numeric to align with repo conventions).
53+ if [[ ! "${MANUAL_RELEASE}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
54+ echo "Provided release '${MANUAL_RELEASE}' is not a valid SemVer (expected X.Y.Z)." >&2
55+ exit 1
56+ fi
57+ echo "Setting workspace version to ${MANUAL_RELEASE} (manual)."
58+ cargo set-version --workspace "${MANUAL_RELEASE}"
59+ else
60+ echo "Bumping workspace version by '${{ inputs.bump }}'."
61+ cargo set-version --workspace --bump "${{ inputs.bump }}"
62+ fi
4463
4564 - name : Read New Version
4665 id : ver
You can’t perform that action at this time.
0 commit comments