标签: github-package-registry

尝试将 maven 包表单 github 注册表添加到 gradle 文件时出现 422:Unprocessable Entity

我在 gitHub 包注册表中有一个名为 test.jar(版本:1.0.5)的 jar,存储库名称是 testRepo,所有者名称:tejas3108。

我正在尝试将此 jar 作为依赖项添加到我的其他 gradle 项目中,但是使用正确的凭据,我仍然收到此消息:Could not GET 'https://maven.pkg.github.com/tejas3108/com.tejas/1.0.5/testRepo-1.0.5.pom'. Received status code 422 from server: Unprocessable Entity. 在浏览器中粘贴相同内容会给出消息:maven 文件的路径无效。

我如何成功地将这个 jar 从 github 注册表添加到我的 build.gradle 中?这是我现在所拥有的:

repositories {
    mavenCentral()
    maven{
        url = "https://maven.pkg.github.com/tejas3108"
        credentials {
            username = "tejas3108"
            password = "<my_github_token>"
        }
    }
}

dependencies {
   compile "com.tejas:testRepo:1.0.5"
}
Run Code Online (Sandbox Code Playgroud)

build.gradle github-package-registry

5
推荐指数
1
解决办法
1822
查看次数

在 Github Action 中通过 Yarn 从 Github Package Registry 下载私有模块?发布有效,但安装遇到“401 Unauthorized”

由于各种原因,我们一直在使用 yarn 来管理我们的包,所以我们不能依赖 package-lock.json 来使用 npm 和 github 操作。

我们无法让 Yarn 作为 github 操作的一部分进行身份验证。我们已经将我们的 repo npmrc 配置为:

@COMPANY:registry=https://npm.pkg.github.com
registry=https://registry.npmjs.org/
Run Code Online (Sandbox Code Playgroud)

我们将这个动作用于纱线。

这是我们只是尝试安装模块的基本设置——仅此而已。

name: CI
on: [push]
jobs:
  build:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: borales/actions-yarn@v2.1.0
        with:
          auth-token: ${{ secrets.GITHUB_TOKEN }}
          registry-url: "https://npm.pkg.github.com"
          scope: tlabs
          cmd: version
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_REGISTRY_URL: https://npm.pkg.github.com
      - name: Create NPMRC
        run: |
          echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
      - name: Install
        run: |
           yarn install --verbose
Run Code Online (Sandbox Code Playgroud)

默认情况下,此操作将尝试运行安装以绕过我在“版本”中提供的基本命令,因此它仅显示纱线版本,仅此而已。

运行 yarn …

github yarnpkg github-actions github-package-registry github-ci

5
推荐指数
1
解决办法
2178
查看次数

Gradle 无法从 Github 包注册表下载包

使用 gradle 上传公共包:https : //github.com/ttiganik/hrd-java-test-registry/packages/61312

但我无法下载它。我尝试了不同的URL-s 和 package names,但它们都不起作用。

根据文档,正确的 URL-s 应该是:

repositories {
    maven {
        url "https://maven.pkg.github.com/ttiganik/hrd-java-test-registry"
        credentials {
            username = System.properties['hmGithubUser']
            password = System.properties['hmGithubToken']
        }
    }
}

dependencies {
    implementation 'com.ttiganik:test:1.0.0'
}
Run Code Online (Sandbox Code Playgroud)

凭据与上传的凭据相同。

gradle installDebug 说它从正确的位置看:

> Could not find com.ttiganik:test:1.0.0.
  Searched in the following locations:
    - https://maven.pkg.github.com/ttiganik/com/ttiganik/test/1.0.0/test-1.0.0.pom
    - https://maven.pkg.github.com/ttiganik/com/ttiganik/test/1.0.0/test-1.0.0.jar
  Required by:
Run Code Online (Sandbox Code Playgroud)

但它不会安装它。

如果我注释掉 maven 存储库中的凭据,它会显示 401 unauthorised。所以位置似乎是正确的。

我的 GPR 配置有什么问题?

gradle github-package-registry

5
推荐指数
1
解决办法
565
查看次数

GitHub 包:用于 GitHub 组织的单个 Maven 存储库

我想使用 GitHub 包为 GitHub 组织中的多个存储库存储 Maven 工件。目前,似乎对于每个项目,都需要一个单独的 (Maven) 存储库配置条目来指向该 (GitHub) 存储库的 Maven 存储库:

<repository>
  <id>github</id>
  <name>GitHub OWNER Apache Maven Packages</name>
  <url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
</repository>
Run Code Online (Sandbox Code Playgroud)

将要发布的Maven项目对应的配置是:

<distributionManagement>
   <repository>
     <id>github</id>
     <name>GitHub OWNER Apache Maven Packages</name>
     <url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
   </repository>
</distributionManagement>
Run Code Online (Sandbox Code Playgroud)

有没有办法将软件包配置为全部转到单个 REPOSITORY?将 REPOSITORY 设置为组织中不同的现有或不存在 (GitHub) 存储库会导致构建失败,完全删除 /REPOSITORY 也是如此

github package-management maven github-actions github-package-registry

5
推荐指数
3
解决办法
417
查看次数

无法从 Github 容器注册表 (GHCR) 提取公共映像

我已将映像推送到 Github 容器注册表 (GHCR) 并将其公开。当我尝试拉它时,出现错误(我已经完成了docker login)。

docker pull ghcr.io/username/reponame:master

我收到的错误:

Error response from daemon: Head "https://ghcr.io/v2/username/reponame/manifests/master": denied: denied

可见性是公开的: 在此输入图像描述

我找不到有关此错误的太多信息,但这篇文章描述了相同的问题: https: //github.com/orgs/community/discussions/27116。然而,仅仅等待对我来说没有用。

github docker github-package-registry github-container-registry

4
推荐指数
1
解决办法
2989
查看次数

将 NPM 模块从 Github Actions 发布到 github 包注册表?

到目前为止,我的 YML 不断根据其他 stackoverflow 线程 + 文档添加位:

name: Node install, build and test

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]
    steps:
      - uses: actions/checkout@v1
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Create NPMRC
        run: echo "//registry.npmjs.org/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
      - name: Publish to Github Packages
        run: |
          npm config set _auth $NODE_AUTH_TOKEN
          npm publish
        env:
          NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN}}

Run Code Online (Sandbox Code Playgroud)

在我的 package.json 中,我有:

  "publishConfig": { …
Run Code Online (Sandbox Code Playgroud)

github github-actions github-package-registry

3
推荐指数
1
解决办法
1132
查看次数

如何使用 Visual Studio 2019 设置私有 Nuget 包注册表?

我正在尝试通过 NuGet 包管理器在 Visual Studio 2019 中提供一个 .NET Framework v4.5.2 包,该包来自 Github 的私有 NuGet 包注册表系统。

我正在使用的重要东西:

  • .NET 框架 4.5.2
  • Github 操作
  • GitHub
  • Github 包注册中心 (GPR)
  • Visual Studio 2019/NuGet 包管理器

我的目标是什么?

整个生命周期看起来有点像这样:

  1. 我的项目的 repo 有一个 CI 工作(Github 品牌)要msbuild发布nupkg。它将所有内容打包并部署到https://nuget.pkg.github.com/ <my-private-org>。
  2. 在 Visual Studio 2019 中,打开一个给定的项目,用户应该能够引用https://nuget.pkg.github.com/ <my-private-org> 作为自定义 NuGet 提要,并声明“我的项目”作为依赖。

什么有效,什么无效?

[Private] Failed to retrieve metadata from source 'https://nuget.pkg.github.com/<my-private-organization>/query?q=&skip=0&take=26&prerelease=true&supportedFramework=.NETFramework,Version=v4.7&semVerLevel=2.0.0'.
  Response status code does …
Run Code Online (Sandbox Code Playgroud)

.net nuget visual-studio-2019 github-package-registry

3
推荐指数
1
解决办法
1453
查看次数

GitHub 容器注册表和 Docker 的 Github Packages 之间有什么区别?

据我了解,GitHub 提供了两种存储容器镜像的选项:ContainerRegistry 和 Packages,但我认为区别并不明显。他们在博客文章中表示, “借助 GitHub Actions,发布到 GitHub Container Registry 变得很容易。” 但给定的示例将映像推送到 Packages,而不是 Container Registry。

那么,这两个平台可以互换使用吗?其中一个平台是否比另一个平台更有优势?

github docker container-registry github-package-registry

3
推荐指数
1
解决办法
2082
查看次数

如何从一个存储库访问同一组织下的其他存储库的 github 包注册表?

我在有Org两个不同存储库repo-1repo-2.
我已将大约 50 个奇怪的 Maven 依赖项上传到 的 GitHub Packages 注册表repo-1,现在我们正在迁移到repo-2. pom.xml 和所有 GitHub Actions 工作流程都按原样复制。因此,我需要访问repo-2Maven 构建工作流程的同一组依赖项。但是,repo-2 无法从repo-1Packages 注册表下载依赖项。

工作流程片段:

- name: build
  run: mvn clean package '-Dmaven.test.skip=true' '-Dmaven.wagon.http.pool=false' --file pom.xml -B -X
  env:
    GITHUB_TOKEN: ${{ github.token }}
    MAVEN_OPTS: -Xmx3072M -Xss128M -XX:MetaspaceSize=512M -XX:MaxMetaspaceSize=2048M -XX:+CMSClassUnloadingEnabled
Run Code Online (Sandbox Code Playgroud)

pom.xml 中的存储库配置片段:

<repositories>
    <repository>
        <id>central</id>
        <url>https://repo1.maven.org/maven2</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>1_maven.apache.org</id>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <url>https://repo.maven.apache.org/maven2</url>
        <layout>default</layout> …
Run Code Online (Sandbox Code Playgroud)

github github-actions github-package-registry

3
推荐指数
2
解决办法
2738
查看次数

推送到 git 包失败并显示有效的 GITHUB_TOKEN

充分研究了有关将包推送到 Git 的 github 文档。我正在使用的讲师的代码中满足了文档中的所有要点。

寻找错别字等。

这是课程 YAML,它与讲师版本完全比较:

name: Push to GitHub Packages

on:
  push:
  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 5.0.x
    - name: Restore dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --configuration Release --no-restore 

    - name: Pack
      run: dotnet pack --configuration Release --no-build --output .
      
    - name: Push
      run: |
        dotnet nuget add source --username *** --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/***/index.json"
        dotnet …
Run Code Online (Sandbox Code Playgroud)

github nuget github-actions github-package-registry github-packages

3
推荐指数
1
解决办法
447
查看次数