@@ -24,30 +24,24 @@ jobs:
2424 run : |
2525 # Determine package name from release tag or workflow dispatch input
2626 if [ "${{ github.event_name }}" = "release" ]; then
27- if [[ "${{ github.event.release.tag_name }}" == *"core-v"* ]]; then
28- PACKAGE_NAME="core"
29- PACKAGE_PATH="libs/core"
30- TAG_PATTERN="core-v"
31- elif [[ "${{ github.event.release.tag_name }}" == *"public-health-v"* ]]; then
32- PACKAGE_NAME="public_health"
33- PACKAGE_PATH="libs/public_health"
34- TAG_PATTERN="public-health-v"
35- fi
36- elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
27+ # Extract package name from tag by stripping version (core-v1.0.0 -> core, public-health-v1.0.0 -> public-health)
28+ TAG_NAME="${{ github.event.release.tag_name }}"
29+ # Remove -v* suffix to get package name, then convert hyphens to underscores for public_health
30+ PACKAGE_RAW="${TAG_NAME%-v*}"
31+ PACKAGE_NAME="${PACKAGE_RAW//-/_}"
32+ else
33+ # Use input directly for workflow_dispatch
3734 PACKAGE_NAME="${{ github.event.inputs.package }}"
38- if [ "$PACKAGE_NAME" = "core" ]; then
39- PACKAGE_PATH="libs/core"
40- TAG_PATTERN="core-v"
41- elif [ "$PACKAGE_NAME" = "public_health" ]; then
42- PACKAGE_PATH="libs/public_health"
43- TAG_PATTERN="public-health-v"
44- fi
4535 fi
4636
37+ # Transform package name to path and tag pattern using string manipulation
38+ PACKAGE_PATH="libs/${PACKAGE_NAME}"
39+ TAG_PATTERN="${PACKAGE_NAME//_/-}-v" # public_health -> public-health-v, core -> core-v
40+
4741 echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
4842 echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV
4943 echo "TAG_PATTERN=$TAG_PATTERN" >> $GITHUB_ENV
50- echo "Deploying package: $PACKAGE_NAME from path: $PACKAGE_PATH"
44+ echo "Deploying package: $PACKAGE_NAME from path: $PACKAGE_PATH with tag pattern: $TAG_PATTERN "
5145
5246 - uses : actions/checkout@v4
5347 with :
0 commit comments