Skip to content

Commit 22cbcce

Browse files
committed
Add dynamic version extraction and file handling in release workflow
1 parent 602546c commit 22cbcce

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ jobs:
8989
needs: build
9090
runs-on: ubuntu-latest
9191
steps:
92+
- name: Get the version
93+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
94+
9295
- name: Download all artifacts
9396
uses: actions/download-artifact@v4
9497
with:
@@ -104,11 +107,24 @@ jobs:
104107
105108
- name: Create "any" and "noarch" packages
106109
run: |
107-
# For demonstration, create symlinks to the amd64 packages
108-
# In a real scenario, you might need to create truly architecture-independent packages
110+
# For demonstration, create copies of the amd64 packages for architecture-independent packages
109111
cd release_files
110-
cp agent_${{ env.VERSION }}_amd64.deb agent_${{ env.VERSION }}_any.deb
111-
cp agent-${{ env.VERSION }}-1.x86_64.rpm agent-${{ env.VERSION }}-1.noarch.rpm
112+
ls -la
113+
# Find the correct files dynamically instead of hardcoding names
114+
AMDEB=$(find . -name "*amd64.deb" | head -1)
115+
AMRPM=$(find . -name "*x86_64.rpm" | head -1)
116+
117+
if [ -n "$AMDEB" ]; then
118+
cp "$AMDEB" "agent_${VERSION}_any.deb"
119+
else
120+
echo "Warning: No amd64 DEB package found"
121+
fi
122+
123+
if [ -n "$AMRPM" ]; then
124+
cp "$AMRPM" "agent-${VERSION}-1.noarch.rpm"
125+
else
126+
echo "Warning: No x86_64 RPM package found"
127+
fi
112128
113129
- name: Create Release
114130
uses: softprops/action-gh-release@v1

0 commit comments

Comments
 (0)