Skip to content

Commit 226ad80

Browse files
authored
Merge pull request #2680 from vitaliyboykocontributor/mcp-stuff
Fix release asset upload filename resolution
2 parents 6022cb6 + b282d2b commit 226ad80

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

.github/workflows/asset.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
env:
1212
GITHUB_RELEASE_PRERELEASE: ${{ github.event.release.prerelease }}
1313
GITHUB_RELEASE_ID: ${{ github.event.release.id }}
14-
PLUGIN_VERSION: ${{ github.event.release.prerelease && format('{0}-alpha.{1}', github.event.release.tag_name, github.event.release.id) || github.event.release.tag_name }}
1514

1615
steps:
1716
- uses: actions/checkout@v3
@@ -25,14 +24,28 @@ jobs:
2524
run: chmod +x gradlew
2625

2726
- name: Build Plugin
28-
run: ./gradlew buildPlugin --no-daemon
27+
run: ./gradlew clean buildPlugin --no-daemon
28+
29+
- name: Resolve built asset
30+
run: |
31+
shopt -s nullglob
32+
assets=(build/distributions/*.zip)
33+
34+
if [ "${#assets[@]}" -ne 1 ]; then
35+
echo "Expected exactly one built plugin archive, found ${#assets[@]}."
36+
printf '%s\n' "${assets[@]}"
37+
exit 1
38+
fi
39+
40+
echo "ASSET_PATH=${assets[0]}" >> "$GITHUB_ENV"
41+
echo "ASSET_NAME=$(basename "${assets[0]}")" >> "$GITHUB_ENV"
2942
3043
- name: Upload Plugin to Release Assets
3144
uses: actions/upload-release-asset@v1
3245
with:
3346
upload_url: ${{ github.event.release.upload_url }}
34-
asset_path: ./build/distributions/Magento 2 and Adobe Commerce Support-${{ env.PLUGIN_VERSION }}.zip
35-
asset_name: Magento 2 and Adobe Commerce Support-${{ env.PLUGIN_VERSION }}.zip
47+
asset_path: ${{ env.ASSET_PATH }}
48+
asset_name: ${{ env.ASSET_NAME }}
3649
asset_content_type: application/zip-archive
3750
env:
3851
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)