Skip to content

Commit 6842ff3

Browse files
authored
feat: Add metadata to nexus workflow
1 parent 86c3c40 commit 6842ff3

1 file changed

Lines changed: 48 additions & 3 deletions

File tree

.github/workflows/nexus.yml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Nexus Deployment
33
on:
44
push:
55
branches:
6-
- main
6+
- master
77

88
jobs:
99
deploy:
@@ -18,14 +18,59 @@ jobs:
1818
run: npm install
1919
- name: Build and Package Release
2020
run: npm run package
21-
- name: Deploy to Nexus
21+
- name: Generate Metadata
22+
run: |
23+
sudo apt install libarchive-zip-perl -y
24+
jq --null-input \
25+
--arg name "Analytics" \
26+
--arg desc "Provides hardware and gameplay analytics to the Flashpoint Project" \
27+
--arg date $(date +%s) \
28+
--arg download $(du -b extension.fplx | awk '{print $1}') \
29+
--arg install $(7z l extension.fplx | tail -n 1 | awk '{print $3}') \
30+
--arg hash $(crc32 extension.fplx) \
31+
'{
32+
"title": $name,
33+
"description": $desc,
34+
"date-modified": $date,
35+
"download-size": $download,
36+
"install-size": $install,
37+
"crc32": $hash
38+
}' > metadata.json
39+
- name: Deploy File to Nexus
2240
uses: sonatype-nexus-community/nexus-repo-github-action@master
2341
with:
2442
serverUrl: https://nexus-dev.unstable.life
2543
username: github
2644
password: ${{ secrets.NEXUS_PASSWORD }}
2745
format: raw
28-
repository: launcher
46+
repository: components
2947
coordinates: directory=/
3048
assets: filename=extension-analytics.zip
3149
filename: extension.fplx
50+
- name: Deploy Metadata to Nexus
51+
uses: sonatype-nexus-community/nexus-repo-github-action@master
52+
with:
53+
serverUrl: https://nexus-dev.unstable.life
54+
username: github
55+
password: ${{ secrets.NEXUS_PASSWORD }}
56+
format: raw
57+
repository: components
58+
coordinates: directory=/
59+
assets: filename=extension-analytics.json
60+
filename: metadata.json
61+
- name: Generate components.xml
62+
run: |
63+
git clone https://gitlab.unstable.life/flashpoint/docker/nexus-deploy-action.git nexus
64+
cd nexus
65+
python3 ./merge-metadata.py "https://nexus-dev.unstable.life/service/rest/v1/search?repository=development&name=*.json" components.xml
66+
- name: Deploy components.xml to Nexus
67+
uses: sonatype-nexus-community/nexus-repo-github-action@master
68+
with:
69+
serverUrl: https://nexus-dev.unstable.life
70+
username: github
71+
password: ${{ secrets.NEXUS_PASSWORD }}
72+
format: raw
73+
repository: components
74+
coordinates: directory=/
75+
assets: filename=components.xml
76+
filename: ./nexus/components.xml

0 commit comments

Comments
 (0)