Skip to content

Commit 32e7d39

Browse files
committed
added workflow dispatch options
1 parent 5aaee5b commit 32e7d39

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎.github/workflows/build-image.yml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,27 @@ jobs:
4747
echo "TARGET=$(grep -oP 'TARGET=\K.*' build.conf.defaults)" >> $GITHUB_OUTPUT
4848
4949
# export base NETHSECURITY_VERSION from build.conf.defaults
50-
NETHSECURITY_VERSION=$(grep -oP 'NETHSECURITY_VERSION=\K.*' build.conf.defaults)
50+
BASE_VERSION=$(grep -oP 'NETHSECURITY_VERSION=\K.*' build.conf.defaults)
5151
COMMIT_HASH=$(git rev-parse --short HEAD)
5252
TIMESTAMP=$(date +'%Y%m%d%H%M%S')
53-
echo "NETHSECURITY_VERSION=${NETHSECURITY_VERSION}" >> $GITHUB_OUTPUT
53+
echo "NETHSECURITY_VERSION=${BASE_VERSION}" >> $GITHUB_OUTPUT
5454
5555
# When pushing to main branch, set REPO_CHANNEL to dev
5656
if [[ "${{ github.ref }}" == refs/heads/main ]]; then
5757
echo "REPO_CHANNEL=dev" >> $GITHUB_OUTPUT
5858
echo "BUILD_SEMVER_SUFFIX=-dev.${TIMESTAMP}.${COMMIT_HASH}" >> $GITHUB_OUTPUT
5959
60-
# Otherwise, get the branch name for branch channel builds
60+
# For pull requests and workflow_dispatch, add timestamp suffix
6161
elif [[ "${{ github.event_name }}" == 'pull_request' ]]; then
6262
BRANCH_NAME="${{ github.head_ref }}"
6363
echo "REPO_CHANNEL=${BRANCH_NAME}" >> $GITHUB_OUTPUT
6464
echo "BUILD_SEMVER_SUFFIX=-${BRANCH_NAME}.${TIMESTAMP}.${COMMIT_HASH}" >> $GITHUB_OUTPUT
65+
66+
elif [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
67+
BRANCH_NAME=$(echo "${{ github.ref }}" | sed 's|refs/heads/||')
68+
echo "REPO_CHANNEL=${BRANCH_NAME}" >> $GITHUB_OUTPUT
69+
echo "BUILD_SEMVER_SUFFIX=-.${TIMESTAMP}.${COMMIT_HASH}" >> $GITHUB_OUTPUT
70+
6571
fi
6672
- name: Build the image
6773
env:

0 commit comments

Comments
 (0)