Packaging workflow using actions does not upload to latest release #180854
Replies: 12 comments
-
|
Your build is actually working. The packages aren’t “vanishing”, they’re never being attached to the release in the first place. There are three separate issues in this workflow that explain the behavior.
This is the biggest blocker. You are using: on: In that context, these conditions are false: if: github.ref_type == 'tag' Because workflow_run is triggered by another workflow, not by a tag push. As a result, both softprops/action-gh-release steps are silently skipped. That alone explains why nothing ends up in the release. Fix: remove that condition entirely, or gate on the tag explicitly via the event payload.
You currently have: permissions: Uploading assets to a release requires write access. The action may appear to run, but GitHub will not attach anything. Fix: permissions:
You are doing: tag_name: ${{ steps.get_release.outputs.release_name }} But release_name is not the same thing as a tag. Fix: pass the actual tag, for example the version you already extracted: tag_name: ${{ needs.extractTag.outputs.my_version }} Or retrieve the release tagName instead of name via gh. Why artifacts appear but releases don’t actions/upload-artifact works because it stores files inside the workflow Release uploads fail because: the step is skipped permissions are insufficient the wrong identifier is used Nothing is being deleted. The release upload never happens. |
Beta Was this translation helpful? Give feedback.
-
|
To fix the issue: Remove if: github.ref_type == 'tag' Change permissions to contents: write Pass a tag, not a release name, to action-gh-release Once those are corrected, the RPM and DEB files will reliably appear in the release assets. |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
The packages are not disappearing; the upload step is never actually attaching them to the release. First, the workflow is triggered by on:
workflow_run:
workflows: [Multi platform Release]
types:
- completedBecause of this, the event context does not contain a tag. The condition below will always evaluate to false: if: github.ref_type == 'tag'As a result, the step that uploads the files to the release is skipped: - name: Attach to Existing Release
uses: softprops/action-gh-release@v2Removing that condition allows the step to run. The second issue is permissions. The workflow currently uses read-only access: permissions:
contents: readUploading assets to a release requires write access. Change it to: permissions:
contents: writeAfter removing the |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
So the workflow runs fine but the files just vanish — I had the same kind of headache before. Pretty sure I spotted a few things: The if: github.ref_type == 'tag' condition on your release step is the main culprit. Since this workflow is triggered by workflow_run and not a direct tag push, that condition is always false, so the attach step just... skips. No error, no warning, files gone. Sneaky one. Also noticed you're still using ::set-output which got deprecated a while back — on newer runners it can fail silently too, so worth fixing while you're in there. Swap it to >> $GITHUB_OUTPUT and change the JSON field from name to tagName since that's what the release action actually needs: And one more thing — your permissions at the top say contents: read, but uploading to a release needs write. Change that to contents: write otherwise it'll just silently fail on the upload too. |
Beta Was this translation helpful? Give feedback.
-
|
A few things in this workflow would explain why the packages are built but never appear on the release. The biggest ones:
if: github.ref_type == 'tag'In a
permissions:
contents: readUploading release assets needs write permission: permissions:
contents: write
I would simplify the upload part like this: permissions:
contents: write
# after building the rpm/deb
- name: Get latest release tag
id: get_release
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh release list --repo "${{ github.repository }}" --limit 1 --json tagName --jq '.[0].tagName')
echo "tag_name=$tag" >> "$GITHUB_OUTPUT"
- name: Attach package to release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.get_release.outputs.tag_name }}
files: |
rpmbuild/RPMS/${{ env.ARCH }}/*.rpm
${{ env.PKG_NAME }}*.debIf you want the packaging workflow to always upload to the release that triggered the previous workflow, it is even better to pass the original tag through explicitly instead of asking for "latest release". "Latest" can become wrong if another release is created while this workflow is still building. |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
Hi, The issue is with your softprops/action-gh-release step. You're using tag_name: ${{ steps.get_release.outputs.release_name }}, but steps.get_release.outputs.release_name is actually the release title, not the tag name. The action needs a valid tag name to attach files to the release. Fix: Change this: yaml yaml yaml yaml
yaml Hope this helps! 👍 |
Beta Was this translation helpful? Give feedback.
-
|
Hi, The issue is with your tag_name in softprops/action-gh-release. Problem: yaml Fix: Update your get_release step to get both name and ID: yaml
yaml
That should solve it! 👍 |
Beta Was this translation helpful? Give feedback.
-
|
I updated it to this following the instructions, but it still does not attach anything. The command |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Workflow Configuration
Discussion Details
I have a workflow that runs successfully (no errors produced) by generating an RPM and DEB packages for the latest repository release tag. However, when it finishes the action does not deposit the generated RPM/DEB packages into the latest release, they simply vanish.
Pre-conditions
Workflow
Beta Was this translation helpful? Give feedback.
All reactions