Skip to content

Commit b2c201b

Browse files
committed
refactor(ci): simplify release workflow repository naming
- Remove dependency on repo-names.json mapping file - Use consistent portal-plugin- prefix for repository names - Simplify matrix generation using awk instead of jq - Remove redundant comments
1 parent 9d205a8 commit b2c201b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/release-go.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@ jobs:
3636
run: |
3737
./scripts/release-go.sh
3838
if [ -f "/tmp/modified_apps.txt" ] && [ -s "/tmp/modified_apps.txt" ]; then
39-
# Extract branch name from the full ref
4039
BRANCH_NAME=${GITHUB_REF#refs/heads/}
4140
git push origin HEAD:${BRANCH_NAME}
42-
# Record the commit hash
4341
echo "commit_hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
4442
fi
4543
@@ -52,17 +50,18 @@ jobs:
5250
exit 0
5351
fi
5452
55-
# Use jq to read the mapping file and create the matrix
53+
# Read the mapping file and create the matrix
5654
while IFS=, read -r app version; do
57-
# Strip 'portal-' prefix if it exists to avoid duplication
58-
app_name=${app#portal-}
59-
repo=$(jq -r --arg pkg "$app" '.[$pkg] // $pkg' .github/config/repo-names.json)
60-
echo "$app_name,$version" >> /tmp/mapped_apps.txt
55+
# Get base name without portal- prefix for repository mapping
56+
base_name=${app#portal-}
57+
# Create the repository name with portal-plugin- prefix
58+
repo="portal-plugin-$base_name"
59+
echo "$app,$version,$repo" >> /tmp/mapped_apps.txt
6160
done < <(paste -d, /tmp/modified_apps.txt /tmp/module_versions.txt)
6261
63-
# Create matrix parameter using the mapped names
62+
# Create matrix parameter
6463
matrix=$(cat /tmp/mapped_apps.txt | \
65-
jq -R 'split(",") | {app: .[0], version: .[1]}' | \
64+
awk -F, '{print "{\"app\":\"" $1 "\",\"version\":\"" $2 "\",\"repo\":\"" $3 "\"}"}' | \
6665
jq -s '{include: .}' | tr -d '\n')
6766
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
6867
echo "has_changes=true" >> "$GITHUB_OUTPUT"
@@ -78,7 +77,7 @@ jobs:
7877
uses: peter-evans/repository-dispatch@v3
7978
with:
8079
token: ${{ secrets.PAT_TOKEN }}
81-
repository: LumeWeb/portal-plugin-${{ matrix.app }}
80+
repository: LumeWeb/${{ matrix.repo }}
8281
event-type: update-ui
8382
client-payload: |
8483
{

0 commit comments

Comments
 (0)