gpt4 book ai didi

How to override an existing package version in GitHub Packages(如何覆盖GitHub包中的现有包版本)

转载 作者:bug小助手 更新时间:2023-10-24 22:03:24 27 4
gpt4 key购买 nike



In my Gradle project I have a hardcoded project version - SNAPSHOT.

在我的Gradle项目中,我有一个硬编码的项目版本-快照。


When I push a new version - everything is OK, but if I push the same version for 2nd time - publishing fails. How can I tell GitHub that I want to override existing package?

当我推送一个新版本时-一切正常,但如果我第二次推送相同的版本-发布失败。我如何告诉GitHub我想覆盖现有的包?


For GitHub Actions I have a workflow to publish that project on every push to the main branch:

对于GitHub Actions,我有一个工作流程,可以在每次推送到主分支时发布该项目:


name: Publish package to GitHub Packages
on:
push:
branches: ['main']
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '18'
cache: 'gradle'

- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I'm expecting a new package with the same version to be publish to the GitHub Packages.

我期待着一个相同版本的新包将发布到GitHub包中。


更多回答
优秀答案推荐

Since I did not found any GitHub Action for my task, I decided to create one: https://github.com/marketplace/actions/version-cleaner-action

因为我没有为我的任务找到任何gihub操作,所以我决定创建一个:https://github.com/marketplace/actions/version-cleaner-action




This is possible but first you need to delete that package version and then republish it.

这是可能的,但首先您需要删除该包版本,然后重新发布它。


But keep in mind that:

但请记住:



On GitHub if you have the required access, you can delete:



  • an entire private package

  • an entire public package, if there's not more than 5000 downloads of any version of the package

  • a specific version of a private package

  • a specific version of a public package, if the package version doesn't have more than 5,000 downloads



更多回答

Ok, thx for for info, I've decided to create an Action for that: github.com/marketplace/actions/version-cleaner-action

好的,谢谢,对于信息,我已经决定为它创建一个操作:github.com/marketplace/actions/version-cleaner-action

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com