File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,10 +26,43 @@ jobs:
2626 server-id : github # Value of the distributionManagement/repository/id field of the pom.xml
2727 settings-path : ${{ github.workspace }} # location for the settings.xml file
2828
29+ - name : Prepare deploy POM for GitHub Packages
30+ shell : bash
31+ run : |
32+ python3 - <<'PY'
33+ import xml.etree.ElementTree as ET
34+
35+ src = 'pom.xml'
36+ dst = 'pom.deploy.xml'
37+
38+ tree = ET.parse(src)
39+ root = tree.getroot()
40+
41+ ns = ''
42+ uri = ''
43+ if root.tag.startswith('{'):
44+ uri = root.tag.split('}', 1)[0][1:]
45+ ns = '{' + uri + '}'
46+ # Preserve the default namespace to avoid ns0-prefixed root tags.
47+ ET.register_namespace('', uri)
48+
49+ artifact_id = root.find(f'{ns}artifactId')
50+ if artifact_id is None or not (artifact_id.text or '').strip():
51+ raise SystemExit('project/artifactId not found in pom.xml')
52+
53+ original = artifact_id.text.strip()
54+ lowered = original.lower()
55+ artifact_id.text = lowered
56+ tree.write(dst, encoding='UTF-8', xml_declaration=True)
57+
58+ print(f'Prepared {dst}: artifactId {original} -> {lowered}')
59+ PY
60+
61+
2962 - name : Build with Maven
3063 run : mvn -B package --file pom.xml
3164
3265 - name : Publish to GitHub Packages Apache Maven
33- run : mvn deploy -s $GITHUB_WORKSPACE/settings.xml
66+ run : mvn -f pom.deploy.xml deploy -s $GITHUB_WORKSPACE/settings.xml
3467 env :
3568 GITHUB_TOKEN : ${{ github.token }}
You can’t perform that action at this time.
0 commit comments