Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
add gh packages credentials to mvn settings
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-shamaa committed Dec 27, 2023
1 parent d0203e5 commit 134e6bd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/publish-to-github-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '11'
Expand All @@ -77,11 +79,12 @@ jobs:

- name: Publish package
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>gh</id><username>$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $1}')</username><password>\${env.GH_TOKEN}</password></server></servers></settings>" > ~/.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]
Expand All @@ -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]
Expand Down

0 comments on commit 134e6bd

Please sign in to comment.