use different release name

This commit is contained in:
Ben Sarmiento
2023-10-28 23:36:12 +02:00
parent 2164c2353b
commit ea8085be0e

View File

@@ -82,29 +82,42 @@ jobs:
- name: Download all artifacts - name: Download all artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
- name: Install jq
run: sudo apt-get install jq
- name: Create Release in other repo - name: Create Release in other repo
id: create_release id: create_release
run: | run: |
# Generate the current date in the required format
CURRENT_DATE=$(date +'%Y%m%d%H%M')
# Create the release in the other repo
RESPONSE=$(curl -s -X POST \ RESPONSE=$(curl -s -X POST \
-H "Authorization: token ${{ secrets.PAT }}" \ -H "Authorization: token ${{ secrets.PAT }}" \
-H "Accept: application/vnd.github.v3+json" \ -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/debridmediamanager/zurg-testing/releases \ https://api.github.com/repos/debridmediamanager/zurg-testing/releases \
-d '{ -d '{
"tag_name": "release-${{ needs.determine_version.outputs.build_version }}", "tag_name": "release-'$CURRENT_DATE'",
"name": "Release ${{ needs.determine_version.outputs.build_version }}", "name": "Release '$CURRENT_DATE'",
"draft": false, "draft": false,
"prerelease": false "prerelease": false
}') }')
# Extract the release ID from the response
RELEASE_ID=$(echo "$RESPONSE" | jq ".id") RELEASE_ID=$(echo "$RESPONSE" | jq ".id")
# Set the RELEASE_ID environment variable for subsequent steps
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
- name: Upload Artifacts to other repo's release - name: Upload Artifacts to other repo's release
run: | run: |
for artifact in $(ls -d */); do for artifact in $(ls); do
curl -s -X POST \ if [[ -f "$artifact" ]]; then
-H "Authorization: token ${{ secrets.PAT }}" \ curl -s -X POST \
-H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token ${{ secrets.PAT }}" \
-H "Content-Type: $(file -b --mime-type $artifact)" \ -H "Accept: application/vnd.github.v3+json" \
--data-binary "@$artifact" \ -H "Content-Type: $(file -b --mime-type $artifact)" \
"https://uploads.github.com/repos/debridmediamanager/zurg-testing/releases/${RELEASE_ID}/assets?name=$(basename $artifact)" --data-binary "@$artifact" \
"https://uploads.github.com/repos/debridmediamanager/zurg-testing/releases/${RELEASE_ID}/assets?name=$(basename $artifact)"
fi
done done