Skip to content

Commit 51be35d

Browse files
committed
ci: publish
1 parent a7463aa commit 51be35d

File tree

2 files changed

+22
-128
lines changed

2 files changed

+22
-128
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@ on:
77

88
jobs:
99
build:
10-
1110
runs-on: ubuntu-latest
12-
11+
permissions:
12+
contents: read
13+
packages: write
14+
env:
15+
GITHUB_USERNAME: ${{secrets.GITHUB_ACTOR}}
16+
GITHUB_PASSWORD: ${{secrets.GITHUB_TOKEN}}
1317
steps:
14-
- uses: actions/checkout@v1
18+
- name: Checkout code
19+
uses: actions/checkout@v4
1520

16-
- name: Set up JDK 1.8
17-
uses: actions/setup-java@v1
21+
- name: Set up Java
22+
uses: actions/setup-java@v4
1823
with:
1924
java-version: 1.8
25+
distribution: 'temurin'
2026

21-
- name: Build and Test
22-
run: mvn clean install -DskipTests -Dmaven.test.skip=true
23-
24-
- name: Publish with Maven
25-
if: github.ref == 'refs/heads/master'
26-
run: mvn deploy -PdeployCortex -DskipTests -Dmaven.test.skip=true
27+
- name: Deploy to Maven repository
28+
run: mvn --batch-mode deploy -DskipTests -Dmaven.test.skip=true
2729
env:
28-
GITHUB_USERNAME: ${{secrets.GITHUB_ACTOR}}
29-
GITHUB_PASSWORD: ${{secrets.GITHUB_TOKEN}}
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+

pom.xml

Lines changed: 7 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -37,121 +37,13 @@
3737
</developer>
3838
</developers>
3939

40-
<profiles>
41-
<profile>
42-
<id>surefire-java16</id>
43-
<activation>
44-
<property>
45-
<name>java.version</name>
46-
<value>16.0.1</value>
47-
</property>
48-
</activation>
49-
<build>
50-
<plugins>
51-
<plugin>
52-
<groupId>org.apache.maven.plugins</groupId>
53-
<artifactId>maven-surefire-plugin</artifactId>
54-
<version>3.0.0-M5</version>
55-
<configuration>
56-
<runOrder>random</runOrder>
57-
<argLine>-Xms512m -Xmx3500m -DsurefireForkNumber=${surefire.forkNumber} --add-exports java.base/sun.security.x509=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED</argLine>
58-
</configuration>
59-
</plugin>
60-
</plugins>
61-
</build>
62-
</profile>
63-
<!-- Performing a release deployment requires setting of performRelease property -->
64-
<profile>
65-
<id>deploy-artifacts</id>
66-
<activation>
67-
<activeByDefault>false</activeByDefault>
68-
<property>
69-
<name>performRelease</name>
70-
<value>true</value>
71-
</property>
72-
</activation>
73-
74-
<distributionManagement>
75-
<snapshotRepository>
76-
<id>nexus</id>
77-
<!-- Use the localhost endpoint for testing -->
78-
<!-- <url>http://localhost:8081/repository/maven-snapshots/</url> -->
79-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
80-
</snapshotRepository>
81-
<repository>
82-
<id>nexus</id>
83-
<!-- Use the localhost endpoint for testing -->
84-
<!-- <url>http://localhost:8081/repository/maven-releases/</url> -->
85-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
86-
</repository>
87-
</distributionManagement>
88-
89-
<build>
90-
<plugins>
91-
<plugin>
92-
<groupId>org.sonatype.plugins</groupId>
93-
<artifactId>nexus-staging-maven-plugin</artifactId>
94-
<version>1.6.8</version>
95-
<extensions>true</extensions>
96-
<configuration>
97-
<serverId>nexus</serverId>
98-
<!-- Use the localhost endpoint for testing -->
99-
<!-- <nexusUrl>http://localhost:8081/repository/maven-releases/</nexusUrl> -->
100-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
101-
<autoReleaseAfterClose>false</autoReleaseAfterClose>
102-
</configuration>
103-
</plugin>
104-
<plugin>
105-
<groupId>org.apache.maven.plugins</groupId>
106-
<artifactId>maven-gpg-plugin</artifactId>
107-
<version>3.0.1</version>
108-
<executions>
109-
<execution>
110-
<id>sign-artifacts</id>
111-
<phase>verify</phase>
112-
<goals>
113-
<goal>sign</goal>
114-
</goals>
115-
<configuration>
116-
<gpgArguments>
117-
<arg>--pinentry-mode</arg>
118-
<arg>loopback</arg>
119-
</gpgArguments>
120-
</configuration>
121-
</execution>
122-
</executions>
123-
</plugin>
124-
</plugins>
125-
</build>
126-
</profile>
127-
<profile>
128-
<id>deployCortex</id>
129-
<activation>
130-
<activeByDefault>false</activeByDefault> <!-- Ensure the profile is only active if explicitly enabled -->
131-
</activation>
132-
<build>
133-
<plugins>
134-
<!-- Maven Deploy Plugin for publishing -->
135-
<plugin>
136-
<groupId>org.apache.maven.plugins</groupId>
137-
<artifactId>maven-deploy-plugin</artifactId>
138-
<configuration>
139-
<repositoryId>github</repositoryId>
140-
<url>https://maven.pkg.github.com/cortexapps/datadog-api-client</url>
141-
</configuration>
142-
</plugin>
143-
</plugins>
144-
</build>
145-
<distributionManagement>
146-
<repository>
147-
<id>github</id>
148-
<name>Github Packages</name>
149-
<url>https://maven.pkg.github.com/cortexapps/datadog-api-client</url>
150-
</repository>
151-
</distributionManagement>
152-
</profile>
153-
154-
</profiles>
40+
<distributionManagement>
41+
<repository>
42+
<id>github</id>
43+
<name>GitHub Packages</name>
44+
<url>https://maven.pkg.github.com/octocat/hello-world</url>
45+
</repository>
46+
</distributionManagement>
15547

15648
<build>
15749
<resources>

0 commit comments

Comments
 (0)