deploy-nightly
deploy-nightly copied to clipboard
Unsure how max_releases works
Hi, I'm not sure how max_releases should work. You can find the test yml file on bottom. Trying to use that parameter to remove older artifacts with custom names. When I used asset_name: "${{ env.NEW_APK_NAME }}-$$.txt" it worked BUT it removed older artifacts somehow ambiguously (I was never sure which one is going to be deleted).
Now it does not work. Artifacts just stack up and not get deleted at all.
Dummy night-builds URL of my test yml file using deploy-nightly
releases are sorted by created_at date and the oldest releases are being thrown out if they match the given pattern. As you are using an environment variable for the filename (resolved and fixed for deploy-nightly then) it doesn't know which other releases it can delete because it can only delete stuff if it differs in the $$ part but not anywhere else in the filename
Well, even tho' I used the name from ur example it got deleted ambiguously I'd say. But you say "orted by created_at date" which means it does not depend on the time the artifact was added to release. However, I'm thinking why it cannot distinguish there are more artifacts and it should delete some? Well, if I just add "$$" as postfix for asset_name it should work, right? ..or is there something else I can do about it? This Action is probably the best so far I found for what I was looking for.
Edit: Ummm, OKay, now I see the code which handles cleaning old assets. I think that something like "search_pattern" or "common_prefix" or whatever like this would be awsome to have for these situations.
Hey, I tried to make some changes and so.
You can see here: https://github.com/simontom/deploy-nightly
Using this yml: https://github.com/simontom/AndroidRecyclerViewSwipeToDeleteWithUndo/edit/master/.github/workflows/create-pre-release2.yml
BUT it always ends with following error: ##[error]Empty value for parameter 'name': undefined in here https://github.com/simontom/AndroidRecyclerViewSwipeToDeleteWithUndo/runs/480862586?check_suite_focus=true
you removed the name parameter from the upload request so github doesn't know about the new assetName parameter you added: https://github.com/simontom/deploy-nightly/commit/67e4ab33d48ea25884d3aa69d39748227c92cdcf#diff-168726dbe96b3ce427e7fedce31bb0bcR97
you need to use name instead of assetName (name: assetName now)
Great eye! Thanks a bunch. I'm gonna try. It was pretty late already. & if you don't mind I can make PR after I try it works.
the refactoring is good, I'm not satisfied with how the API looks though.
I don't think I would use your code as-is but if you are fine with your code you can keep on using it from your account without problems. I would probably go for a more flexible approach of having some kind of variable interpreter for the filename for the final API which also supports manual date formatting, commit hash, environment variables, etc.
Oh, OKay, sounds interesting! I'll keep my solution so far. And maybe use yours in the future. ;)
Thanks a bunch for you time and help.
Hello! I am having, I think, a similar issue. My repo is https://github.com/MarginallyClever/Robot-Overlord-App
- name: Build installation package
shell: bash
run: |
set -x
set -o pipefail
APP_VERSION=$(ls -1 target/package/RobotOverlord-*-with-dependencies.jar | sed "s/.*RobotOverlord-\([^-]*\)-with-dependencies.jar/\1/") &&
sed -i.bak "s/\(--app-version\).*/\1 $APP_VERSION/" src/main/package/jpackage.cfg &&
jpackage "@src/main/package/jpackage.cfg" "@src/main/package/jpackage-${{matrix.os}}.cfg" --main-jar "RobotOverlord-$APP_VERSION-with-dependencies.jar" &&
ls &&
BINARY=$(find . -maxdepth 1 -iname 'robotoverlord*' | grep -E '(msi$|dmg$|deb$)' | sed "s,./,," | head -1) &&
BINARY_NIGHTLY=$(echo $BINARY | sed 's/\(.*\)\.\(.*\)/\1-nightly-$$.\2/') &&
echo "BINARY=$BINARY" | tee -a $GITHUB_ENV &&
echo "BINARY_NIGHTLY=$BINARY_NIGHTLY" | tee -a $GITHUB_ENV
- name: Deploy installation release
if: github.repository == 'MarginallyClever/Robot-Overlord-App' && github.ref == 'refs/heads/master'
uses: WebFreak001/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # automatically provided by github actions
with:
upload_url: ${{ env.UPLOAD_URL }}
release_id: ${{ env.RELEASE_ID }}
asset_path: ${{ env.BINARY }} # path to archive to upload
asset_name: ${{ env.BINARY_NIGHTLY }} # name to upload the release as, use $$ to insert date (YYYYMMDD) and 6 letter commit hash
asset_content_type: application/zip # required by GitHub API
max_releases: 3 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
This matrix runs three different nightlies, depending on the target platform. It never deletes the old nightly builds. Please tell me what I'm doing wrong and maybe how to fix it?
Super grateful for this Action, thank you for all your hard work.
same issue here as above - nightly builds with different filenames are treated as different release lists.
So
RobotOverlord-2.107.1-nightly-$$.msi
will not delete old files that start with RobotOverlord-2.106.1-nightly-
A more flexible solution than the $$ is not yet implemented in deploy-nightly.
ah. I would be fine with "keep the 6 newest (by creation time)".
that's something I don't want like that in this extension since it's intended to be used like "keep the 6 newest for each platform"
Leaving the version number out of the nightly release is currently supported, but a dynamic name like you have it isn't yet
I'm open to changing my system to something that works for you. a commit number isn't obvious to my users, while a version number is.