Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add auto upload assets #601

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

add auto upload assets #601

wants to merge 2 commits into from

Conversation

AsenHu
Copy link

@AsenHu AsenHu commented Oct 27, 2024

When creating a new release, this action will download the latest build artifacts and upload them to Assets.

@AsenHu
Copy link
Author

AsenHu commented Oct 28, 2024

Now you can manually enter the release tag and action id and it will re-upload the artifact.
If a file with the same name appears, it will be overwritten and uploaded.

@AsenHu
Copy link
Author

AsenHu commented Oct 29, 2024

I understand why the action uses the old workflow file. If you select a commit id when releasing, the action will run the workflow in that commit, which may be outdated.

Therefore, if you want to upload the artifacts generated by the commit before the merge to the release, you must manually run the workflow and fill in the action id and release tag.

@AsenHu
Copy link
Author

AsenHu commented Nov 1, 2024

I completed the test and both the manual and automated runs now upload artifacts as expected.

@girlbossceo
Copy link
Owner

I'll take a look at this very soon

@AsenHu
Copy link
Author

AsenHu commented Nov 16, 2024

Ok, if you need test this action, tell me and I'll run it on my branch.

runs-on: ubuntu-latest

steps:
- name: get latest ci id
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the problem I think I see with these steps is there is no check anywhere if the latest CI run is a tag, or if we're even running in a tag at all.

To me, it just looks like it's going to try automatically uploading binaries every single CI run. I don't know how safe that is.

Here's an example of our Docker publish step, we perform actions based on whether we're in a tag or not: https://github.com/girlbossceo/conduwuit/blob/main/.github/workflows/ci.yml#L511

In this case, I only want to run this if I'm running the workflow from a tag.

I also don't really see anything that replaces existing binaries uploaded. So, if I run a workflow, and re-run it, will it upload two binaries?

Can some safety precautions be added?

Copy link
Author

@AsenHu AsenHu Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every single CI run

This workflow is triggered by publishing, it does not run on every single CI run.

on:
  release:
    types: [published]

This means that it will only run if you are on the releases page, click publish release, and select a tag.

So, if I run a workflow, and re-run it, will it upload two binaries?

No, if there is already a file with the same name in the release, it will be overwritten. It is done by the clobber of gh cli.

gh release upload $TAG "$file" --clobber --repo="${{github.repository}}"

This document describes the function of clobber.

Can some safety precautions be added?

Of course, I can make the workflow exit with an error when it is triggered by commit. Or I can make it run only when the workflow is triggered by publishing, so that even if the workflow is accidentally triggered, there will be no problems.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay then I likely misunderstood then. I guess I can just try it out as is and see what happens.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just enter the action id, and v0.4.7-rc and run it manually, it will upload the action artifact you selected to v0.4.7-rc. You can also run it repeatedly to see if it replaces.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you can let me do this in my fork, which would be safer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants