我想从公共存储库的 GitHub 操作部署到 GitHub 包注册表。
我有一个工作流的 yml 文件:
name: My CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: lein deps
- name: Run tests
run: lein test
- name: Generate pom
run: lein pom
- name: Deploy
run: mvn deploy
我使用 Leiningen 构建项目并生成 POM 文件。然后我想使用 Maven 将工件部署到 GitHub 包注册表。
这在Deploy
命令上失败(我已将个人信息替换为...
):
[WARNING] Could not transfer metadata ... from/to github (https://maven.pkg.github.com/.../...): Not authorized
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.343 s
[INFO] Finished at: 2019-08-29T13:08:42Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ...: Failed to retrieve remote metadata .../maven-metadata.xml: Could not transfer metadata ... from/to github (https://maven.pkg.github.com/.../...): Not authorized -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
##[error]Process completed with exit code 1.
我看到身份验证失败。我也尝试过这一步,结果相同:
run: mvn deploy -Dserver.username=... -Dserver.password=${{ secrets.GITHUB_TOKEN }} -DskipTests
我不想提供用户名/密码或令牌,因为这是一个公共存储库。有没有办法发布呢?
谢谢!