Skip to content

Commit 5f26520

Browse files
committed
Change expected repo layout - jar and pom
1 parent a1fe9bd commit 5f26520

1 file changed

Lines changed: 59 additions & 8 deletions

File tree

.github/workflows/distribute-maven-stg.yml

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
name: Distribute from ATR to Maven (stage - RAO)
18+
name: Distribute from ATR to Maven Central
1919
run-name: "${{ inputs.atr-id }}"
2020

2121
on:
@@ -56,6 +56,7 @@ jobs:
5656
ATR_HOST: release-test.apache.org
5757
SSH_PORT: 2222
5858
WORKFLOW: distribute-maven-stg.yml
59+
NJORD_STORE: njord-deployer
5960
RAO_USERNAME: ${{ secrets.RAO_USERNAME }}
6061
RAO_PASSWORD: ${{ secrets.RAO_PASSWORD }}
6162
steps:
@@ -77,13 +78,34 @@ jobs:
7778
<configuration>
7879
<njord.publisher>sonatype-nx3</njord.publisher>
7980
<njord.publisher.sonatype-nx3.baseUrl>https://repository.apache.org:4443/</njord.publisher.sonatype-nx3.baseUrl>
80-
<njord.publisher.sonatype-nx3.releaseRepositoryName>maven-staging</njord.publisher.sonatype-nx3.releaseRepositoryName>
8181
</configuration>
8282
</server>
8383
</servers>
8484
</settings>
8585
EOF
8686
87+
- name: Create pom.xml
88+
run: |
89+
<?xml version="1.0" encoding="UTF-8"?>
90+
<project xmlns="http://maven.apache.org/POM/4.0.0">
91+
<modelVersion>4.0.0</modelVersion>
92+
<groupId>local</groupId>
93+
<artifactId>$NJORD_STORE</artifactId>
94+
<version>1.0</version>
95+
<packaging>pom</packaging>
96+
97+
<build>
98+
<extensions>
99+
<extension>
100+
<groupId>eu.maveniverse.maven.njord</groupId>
101+
<artifactId>extension3</artifactId>
102+
<version>0.9.2</version>
103+
</extension>
104+
</extensions>
105+
</build>
106+
</project>
107+
EOF
108+
87109
- name: Set up JDK 17
88110
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e
89111
with:
@@ -185,9 +207,38 @@ jobs:
185207
SSH_PRIVATE_KEY_PATH: ${{ steps.generate-ssh-key.outputs.ssh_private_key_path }}
186208

187209
- name: Build and stage locally
188-
working-directory: ./stg
189210
run: |
190-
mvn clean deploy -DaltDeploymentRepository=local::njord:
211+
DIR="stg"
212+
BASE="${INPUTS_DISTRIBUTION_PACKAGE}-${INPUTS_DISTRIBUTION_VERSION}"
213+
214+
FILES="" CLASSIFIERS="" TYPES=""
215+
for f in "$DIR/${BASE}"-*.*; do
216+
# Skip checksums and signatures
217+
[[ "$f" =~ \.(asc|sha1|sha256|sha512|md5)$ ]] && continue
218+
# Skip main jar and pom
219+
[[ "$f" == "$DIR/${BASE}.jar" ]] && continue
220+
[[ "$f" == "$DIR/${BASE}.pom" ]] && continue
221+
222+
# Extract classifier and type from filename
223+
suffix="${f#$DIR/${BASE}-}"
224+
classifier="${suffix%.*}"
225+
type="${suffix##*.}"
226+
227+
FILES="${FILES:+$FILES,}$f"
228+
CLASSIFIERS="${CLASSIFIERS:+$CLASSIFIERS,}$classifier"
229+
TYPES="${TYPES:+$TYPES,}$type"
230+
done
231+
232+
mvn deploy:deploy-file \
233+
-Dfile="$DIR/${BASE}.jar" \
234+
-DpomFile="$DIR/${BASE}.pom" \
235+
-Durl=njord: \
236+
-DrepositoryId=njord-local \
237+
${FILES:+-Dfiles="$FILES" -Dclassifiers="$CLASSIFIERS" -Dtypes="$TYPES"}
238+
env:
239+
INPUTS_DISTRIBUTION_PACKAGE: ${{ inputs.distribution-package }}
240+
INPUTS_DISTRIBUTION_VERSION: ${{ inputs.distribution-version }}
241+
191242

192243
- name: Create staging tag
193244
run: |
@@ -206,10 +257,10 @@ jobs:
206257
- name: Get store ID and publish
207258
working-directory: ./stg
208259
run: |
209-
echo "Publishing store: $INPUTS_DISTRIBUTION_PACKAGE-00001"
210-
mvn njord:validate -Dnjord.store=$INPUTS_DISTRIBUTION_PACKAGE-00001 -X
211-
mvn njord:publish -Dnjord.store=$INPUTS_DISTRIBUTION_PACKAGE-00001 -Dnjord.target=rao3 -Dnjord.publisher.sonatype-nx3.releaseRepositoryName=maven-staging -X
212-
mvn njord:drop -Dnjord.store=$INPUTS_DISTRIBUTION_PACKAGE-00001 -X
260+
echo "Publishing store: $NJORD_STORE-00001"
261+
mvn njord:validate -Dnjord.store=$NJORD_STORE-00001
262+
mvn njord:publish -Dnjord.store=$NJORD_STORE-00001 -Dnjord.target=rao3 -Dnjord.publisher.sonatype-nx3.releaseRepositoryName=maven-staging
263+
mvn njord:drop -Dnjord.store=$NJORD_STORE-00001
213264
env:
214265
INPUTS_DISTRIBUTION_PACKAGE: ${{ inputs.distribution-package }}
215266

0 commit comments

Comments
 (0)