Skip to content

Commit 761f3e6

Browse files
committed
chore: Update Maven publish workflow to use local settings file
1 parent cc54cde commit 761f3e6

File tree

1 file changed

+4
-45
lines changed

1 file changed

+4
-45
lines changed

.github/workflows/maven-publish.yml

+4-45
Original file line numberDiff line numberDiff line change
@@ -6,70 +6,29 @@ name: Maven Package
66
on:
77
release:
88
types: [created]
9-
10-
workflow_dispatch:
119

1210
jobs:
1311
build:
12+
1413
runs-on: ubuntu-latest
1514
permissions:
1615
contents: read
1716
packages: write
1817

1918
steps:
2019
- uses: actions/checkout@v4
21-
2220
- name: Set up JDK 8
2321
uses: actions/setup-java@v3
2422
with:
2523
java-version: '8'
2624
distribution: 'temurin'
27-
server-id: github
28-
settings-path: ${{ github.workspace }}
29-
30-
- name: Create settings.xml
31-
run: |
32-
echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
33-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34-
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
35-
http://maven.apache.org/xsd/settings-1.0.0.xsd">
36-
37-
<activeProfiles>
38-
<activeProfile>github</activeProfile>
39-
</activeProfiles>
40-
41-
<profiles>
42-
<profile>
43-
<id>github</id>
44-
<repositories>
45-
<repository>
46-
<id>central</id>
47-
<url>https://repo1.maven.org/maven2</url>
48-
</repository>
49-
<repository>
50-
<id>github</id>
51-
<url>https://maven.pkg.github.com/multiform-validator/java</url>
52-
<snapshots>
53-
<enabled>true</enabled>
54-
</snapshots>
55-
</repository>
56-
</repositories>
57-
</profile>
58-
</profiles>
59-
60-
<servers>
61-
<server>
62-
<id>github</id>
63-
<username>gabriel-logan</username>
64-
<password>${{secrets.MULTIFORM_VALIDATOR_MVN_TOKEN_GITHUB_PACKAGES}}</password>
65-
</server>
66-
</servers>
67-
</settings>' > settings.xml
25+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26+
settings-path: ${{ github.workspace }} # location for the settings.xml file
6827

6928
- name: Build with Maven
7029
run: mvn -B package --file pom.xml
7130

7231
- name: Publish to GitHub Packages Apache Maven
73-
run: mvn deploy -s settings.xml
32+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
7433
env:
7534
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)