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