Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
RMd GITHUB_EVENT_REF_NAME var
Browse files Browse the repository at this point in the history
  • Loading branch information
fheinecke committed Feb 15, 2024
1 parent b46b841 commit e916978
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/tag-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
run: |
generate_version() {
# Example: v1.2.3-gen.4+g5678abcd
# If HEAD is tagged (and matches the format) then the output will be just the tag (no commit count or hash)
git describe --tags --match "v[[:digit:]]*.[[:digit:]]*.[[:digit:]]" | sed 's/\(.*\)-\(.*\)-\(.*\)/\1-gen.\2+\3/'
}
Expand All @@ -73,28 +74,28 @@ jobs:
;;
"pull_request")
echo "environment=build-stage"
echo "version=$(generate_version "$GITHUB_EVENT_REF_NAME")"
echo "version=$(generate_version)"
;;
"push")
REF_TYPE=$(echo "$GITHUB_EVENT_REF" | cut -d'/' -f2)
# Case: commit push event.
if [ "$REF_TYPE" != "tags" ]; then
echo "environment=build-stage"
echo "version=$(generate_version "$GITHUB_EVENT_REF_NAME")"
echo "version=$(generate_version)"
return
fi
# Case: tag event with prerelease version.
if [ "${GITHUB_EVENT_REF_NAME#*-}" != "$GITHUB_EVENT_REF_NAME" ]; then
if [ "${GITHUB_REF_NAME#*-}" != "$GITHUB_REF_NAME" ]; then
echo "environment=build-stage"
echo "version=$GITHUB_EVENT_REF_NAME"
echo "version=$GITHUB_REF_NAME"
return
fi
# Case: tag event with release version. Only this
# should go to prod.
echo "environment=build-prod"
echo "version=$GITHUB_EVENT_REF_NAME"
echo "version=$GITHUB_REF_NAME"
;;
*)
>&2 echo "Unknown GHA event $GITHUB_EVENT_NAME, failing"
Expand All @@ -111,9 +112,7 @@ jobs:
# Log the build details
echo "Built config:" | tee -a "$GITHUB_STEP_SUMMARY"
while read -r line; do
echo "* $line" | tee -a "$GITHUB_STEP_SUMMARY"
done < "$GITHUB_OUTPUT"
sed 's/^/* /' "$GITHUB_OUTPUT" | tee -a "$GITHUB_STEP_SUMMARY"
- name: ${{ inputs.workflow-tag }}
if: inputs.workflow-tag != ''
run: |
Expand Down Expand Up @@ -161,8 +160,11 @@ jobs:
# Download Go dependencies
go mod download
# Binaries and Helm charts
make releases helm-package-charts
# Build Binaries
make releases
# Build Helm charts
make helm-package-charts
# Terraform provider and event handler, as appropriate
go install github.com/konoui/lipo@latest # At some point this should be merged into the buildbox
Expand Down

0 comments on commit e916978

Please sign in to comment.