File tree Expand file tree Collapse file tree
get-version-from-makefile Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : ' Check Tag Exists'
2+ description : ' Checks if a git tag exists and validates it points to current commit'
3+ inputs :
4+ tag :
5+ description : ' Git tag to check'
6+ required : true
7+ outputs :
8+ exists :
9+ description : ' Whether tag exists (true/false)'
10+ value : ${{ steps.check-tag.outputs.exists }}
11+ runs :
12+ using : ' composite'
13+ steps :
14+ - name : Check if tag already exists
15+ id : check-tag
16+ shell : bash
17+ env :
18+ INPUT_TAG : ${{ inputs.tag }}
19+ CURRENT_SHA : ${{ github.sha }}
20+ run : |
21+ TAG="$INPUT_TAG"
22+ if git rev-parse "$TAG" >/dev/null 2>&1; then
23+ TAG_SHA=$(git rev-parse "$TAG^{}")
24+ if [ "$TAG_SHA" = "$CURRENT_SHA" ]; then
25+ echo "Tag $TAG already exists and points to current commit"
26+ echo "exists=true" >> $GITHUB_OUTPUT
27+ else
28+ echo "::error::Tag $TAG already exists but points to a different commit"
29+ echo "Tag SHA: $TAG_SHA"
30+ echo "Current SHA: $CURRENT_SHA"
31+ exit 1
32+ fi
33+ else
34+ echo "Tag $TAG does not exist"
35+ echo "exists=false" >> $GITHUB_OUTPUT
36+ fi
Original file line number Diff line number Diff line change 1+ name : ' Create and Push Tag'
2+ description : ' Creates and pushes a git tag'
3+ inputs :
4+ tag :
5+ description : ' Git tag to create'
6+ required : true
7+ runs :
8+ using : ' composite'
9+ steps :
10+ - name : Create and push tag
11+ shell : bash
12+ env :
13+ INPUT_TAG : ${{ inputs.tag }}
14+ run : |
15+ git config user.name "github-actions[bot]"
16+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
17+
18+ git tag -a "$INPUT_TAG" -m "Release $INPUT_TAG"
19+ git push origin "$INPUT_TAG"
20+ echo "Created and pushed tag: $INPUT_TAG"
Original file line number Diff line number Diff line change 1+ name : ' Create Release Branch'
2+ description : ' Creates or checks out a release branch based on version'
3+ inputs :
4+ version :
5+ description : ' Release version (without v prefix)'
6+ required : true
7+ push :
8+ description : ' Whether to push the branch if created'
9+ required : false
10+ default : ' false'
11+ outputs :
12+ branch-name :
13+ description : ' The release branch name'
14+ value : ${{ steps.create-branch.outputs.branch-name }}
15+ branch-existed :
16+ description : ' Whether the branch already existed'
17+ value : ${{ steps.create-branch.outputs.branch-existed }}
18+ runs :
19+ using : ' composite'
20+ steps :
21+ - name : Create or checkout release branch
22+ id : create-branch
23+ shell : bash
24+ env :
25+ INPUT_VERSION : ${{ inputs.version }}
26+ INPUT_PUSH : ${{ inputs.push }}
27+ run : |
28+ base_branch=release-v$(echo "$INPUT_VERSION" | sed 's/[+-].*//; s/\.[0-9]*$//')
29+ echo "branch-name=$base_branch" >> "$GITHUB_OUTPUT"
30+
31+ if git ls-remote --exit-code --heads origin "$base_branch"; then
32+ echo "Base branch $base_branch already exists"
33+ git fetch origin "$base_branch"
34+ git checkout "$base_branch"
35+ echo "branch-existed=true" >> "$GITHUB_OUTPUT"
36+ else
37+ echo "Creating branch $base_branch"
38+ git checkout -b "$base_branch"
39+ echo "branch-existed=false" >> "$GITHUB_OUTPUT"
40+
41+ if [[ "$INPUT_PUSH" == "true" ]]; then
42+ git push --set-upstream origin "$base_branch"
43+ fi
44+ fi
Original file line number Diff line number Diff line change 1+ name : Create Release
2+ description : ' Creates a GitHub release from a release branch'
3+ inputs :
4+ github-token :
5+ description : ' GitHub token for creating release'
6+ required : true
7+ release-branch :
8+ description : ' Branch the release is created from'
9+ required : false
10+
11+ runs :
12+ using : ' composite'
13+ steps :
14+ - name : Prepare release tag
15+ id : prepare-tag
16+ uses : ./.github/actions/prepare-release-tag
17+
18+ - name : Generate release notes
19+ uses : ./.github/actions/generate-release-notes
20+ with :
21+ tag : ${{ steps.prepare-tag.outputs.tag }}
22+ github-token : ${{ inputs.github-token }}
23+
24+ - name : Create GitHub Release
25+ uses : softprops/action-gh-release@v2
26+ with :
27+ name : ${{ steps.prepare-tag.outputs.tag }}
28+ tag_name : ${{ steps.prepare-tag.outputs.tag }}
29+ body : ${{ env.releaseBody }}
30+ target_commitish : ${{ inputs.release-branch }}
31+ prerelease : ${{ steps.prepare-tag.outputs.prerelease }}
32+ env :
33+ GITHUB_TOKEN : ${{ inputs.github-token }}
Original file line number Diff line number Diff line change 1+ name : ' Detect Prerelease'
2+ description : ' Determines if version is a prerelease (alpha/beta/rc)'
3+ inputs :
4+ version :
5+ description : ' Version to check'
6+ required : true
7+ outputs :
8+ prerelease :
9+ description : ' Whether version is prerelease (true/false)'
10+ value : ${{ steps.detect.outputs.prerelease }}
11+ runs :
12+ using : ' composite'
13+ steps :
14+ - name : Determine if prerelease
15+ id : detect
16+ shell : bash
17+ env :
18+ VERSION : ${{ inputs.version }}
19+ run : |
20+ if [[ "$VERSION" =~ -(alpha|beta|rc) ]]; then
21+ echo "prerelease=true" >> "$GITHUB_OUTPUT"
22+ else
23+ echo "prerelease=false" >> "$GITHUB_OUTPUT"
24+ fi
Original file line number Diff line number Diff line change 1+ name : ' Generate Release Notes'
2+ description : ' Generates release notes using existing script'
3+ inputs :
4+ tag :
5+ description : ' Release tag'
6+ required : true
7+ github-token :
8+ description : ' GitHub token for API access'
9+ required : true
10+ runs :
11+ using : ' composite'
12+ steps :
13+ - name : Generate release notes
14+ shell : bash
15+ env :
16+ GITHUB_TOKEN : ${{ inputs.github-token }}
17+ RELEASE_TAG : ${{ inputs.tag }}
18+ run : bash ./utils/release/github-release-changelog.sh
Original file line number Diff line number Diff line change 1+ name : ' Get Version from Makefile'
2+ description : ' Extracts VERSION from Makefile and formats tag'
3+ outputs :
4+ version :
5+ description : ' Version from Makefile'
6+ value : ${{ steps.get-version.outputs.version }}
7+ tag :
8+ description : ' Git tag with v prefix'
9+ value : ${{ steps.get-version.outputs.tag }}
10+ runs :
11+ using : ' composite'
12+ steps :
13+ - name : Get version from Makefile
14+ id : get-version
15+ shell : bash
16+ run : |
17+ VERSION=$(grep -m 1 "^VERSION ?=" Makefile | sed 's/VERSION ?= //' | xargs)
18+ if [[ -z "$VERSION" ]]; then
19+ echo "::error::Could not extract VERSION from Makefile"
20+ exit 1
21+ fi
22+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
23+ echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
24+ echo "Releasing version: $VERSION (tag: v$VERSION)"
Original file line number Diff line number Diff line change 1+ name : ' Prepare Release Branch'
2+ description : ' Prepares a release branch with updated Makefile'
3+ inputs :
4+ version :
5+ description : ' Release version (without v prefix)'
6+ required : true
7+ push-branch :
8+ description : ' Whether to push the branch if created'
9+ required : false
10+ default : ' false'
11+ expiry :
12+ description : ' QUAY_IMAGE_EXPIRY value'
13+ required : false
14+ default : ' never'
15+ outputs :
16+ branch-name :
17+ description : ' The release branch name'
18+ value : ${{ steps.create-branch.outputs.branch-name }}
19+ branch-existed :
20+ description : ' Whether the branch already existed'
21+ value : ${{ steps.create-branch.outputs.branch-existed }}
22+ runs :
23+ using : ' composite'
24+ steps :
25+ - name : Validate version
26+ uses : ./.github/actions/validate-version
27+ with :
28+ version : ${{ inputs.version }}
29+
30+ - name : Create release branch
31+ id : create-branch
32+ uses : ./.github/actions/create-release-branch
33+ with :
34+ version : ${{ inputs.version }}
35+ push : ${{ inputs.push-branch }}
36+
37+ - name : Update Makefile VERSION
38+ uses : ./.github/actions/update-makefile-version
39+ with :
40+ version : ${{ inputs.version }}
41+
42+ - name : Update Makefile QUAY_IMAGE_EXPIRY
43+ uses : ./.github/actions/update-makefile-expiry
44+ with :
45+ expiry : ${{ inputs.expiry }}
Original file line number Diff line number Diff line change 1+ name : ' Prepare Release Tag'
2+ description : ' Manages release tag creation and metadata'
3+ outputs :
4+ version :
5+ description : ' Version from Makefile'
6+ value : ${{ steps.get-version.outputs.version }}
7+ tag :
8+ description : ' Git tag with v prefix'
9+ value : ${{ steps.get-version.outputs.tag }}
10+ prerelease :
11+ description : ' Whether version is prerelease'
12+ value : ${{ steps.detect-prerelease.outputs.prerelease }}
13+ tag-created :
14+ description : ' Whether a new tag was created'
15+ value : ${{ steps.check-tag.outputs.exists == 'false' }}
16+ runs :
17+ using : ' composite'
18+ steps :
19+ - name : Get version from Makefile
20+ id : get-version
21+ uses : ./.github/actions/get-version-from-makefile
22+
23+ - name : Check if tag exists
24+ id : check-tag
25+ uses : ./.github/actions/check-tag-exists
26+ with :
27+ tag : ${{ steps.get-version.outputs.tag }}
28+
29+ - name : Create and push tag
30+ if : steps.check-tag.outputs.exists == 'false'
31+ uses : ./.github/actions/create-and-push-tag
32+ with :
33+ tag : ${{ steps.get-version.outputs.tag }}
34+
35+ - name : Detect prerelease
36+ id : detect-prerelease
37+ uses : ./.github/actions/detect-prerelease
38+ with :
39+ version : ${{ steps.get-version.outputs.version }}
Original file line number Diff line number Diff line change 1+ name : ' Update Makefile Expiry'
2+ description : ' Updates QUAY_IMAGE_EXPIRY in Makefile'
3+ inputs :
4+ expiry :
5+ description : ' Expiry value to set (e.g., never, 3w)'
6+ required : true
7+ default : ' never'
8+ runs :
9+ using : ' composite'
10+ steps :
11+ - name : Update QUAY_IMAGE_EXPIRY in Makefile
12+ shell : bash
13+ env :
14+ QUAY_IMAGE_EXPIRY : ${{ inputs.expiry }}
15+ run : |
16+ sed -i "s/^QUAY_IMAGE_EXPIRY ?= .*/QUAY_IMAGE_EXPIRY ?= $QUAY_IMAGE_EXPIRY/" Makefile
17+
18+ echo "Updated Makefile QUAY_IMAGE_EXPIRY to $QUAY_IMAGE_EXPIRY"
19+ grep "^QUAY_IMAGE_EXPIRY" Makefile
You can’t perform that action at this time.
0 commit comments