From 134e6bd3681420610326cf7de9b2b52fc80f3ca0 Mon Sep 17 00:00:00 2001 From: Adam Shamaa Date: Wed, 27 Dec 2023 05:10:36 -0500 Subject: [PATCH] add gh packages credentials to mvn settings --- .github/workflows/publish-to-github-packages.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-to-github-packages.yml b/.github/workflows/publish-to-github-packages.yml index cb04631..e18e3d1 100644 --- a/.github/workflows/publish-to-github-packages.yml +++ b/.github/workflows/publish-to-github-packages.yml @@ -62,6 +62,8 @@ jobs: contents: read packages: write steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: java-version: '11' @@ -77,11 +79,12 @@ jobs: - name: Publish package run: | + mkdir -p ~/.m2 + echo "gh$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')\${env.GH_TOKEN}" > ~/.m2/settings.xml cd target/generated-sources/openapi - mvn --batch-mode -DaltDeploymentRepository="$DEPLOYMENT_REPOSITORY" deploy + mvn --batch-mode deploy -DaltDeploymentRepository="${{env.MVN_GH_REPO}}" -DaltSnapshotDeploymentRepository="${{env.MVN_GH_REPO}}" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DEPLOYMENT_REPOSITORY: ${{ secrets.MAVEN_DEPLOYMENT_REPOSITORY_URL}} + MVN_GH_REPO: "gh::default::https://maven.pkg.github.com/${GITHUB_REPOSITORY}" publish-node-package: needs: [build-project-artifacts] @@ -105,7 +108,7 @@ jobs: cd target/generated-sources/npm-package npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ env.GH_TOKEN }} publish-swagger-ui: needs: [publish-java-project, publish-node-package]