Skip to content

Commit

Permalink
Merge pull request #296 from AuthGuard/github-actions-revamp
Browse files Browse the repository at this point in the history
Update maven-publish workflow
  • Loading branch information
kmehrunes committed Dec 25, 2023
2 parents 1369e73 + 6649571 commit fffa02a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
31 changes: 14 additions & 17 deletions .github/workflows/maven-publish.yml
Expand Up @@ -8,27 +8,24 @@ on:
types: [created]

jobs:
build:

publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml

- name: Build with Maven
run: mvn -P github_actions -B package --file pom.xml
- name: Build with Maven
run: mvn -P github_actions -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ secrets.MAVEN_FLOW }}
- name: Publish to GitHub Packages
run: mvn --batch-mode deploy -s $GITHUB_WORKSPACE/maven-settings.xml -P github_actions
env:
PACKAGES_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/maven-settings.xml
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<activeProfiles>
<activeProfile>github_actions</activeProfile>
</activeProfiles>

<servers>
<server>
<id>authguard-github</id>
<username>kmehrunes</username>
<password>${env.PACKAGES_TOKEN}</password>
</server>

<server>
<id>github</id>
<username>kmehrunes</username>
<password>${env.PACKAGES_TOKEN}</password>
</server>
</servers>
</settings>

0 comments on commit fffa02a

Please sign in to comment.