forked from TrustedDataFramework/java-rlp
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (65 loc) · 3.29 KB
/
gradle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Java CI
on:
workflow_dispatch:
permissions: # Global permissions configuration starts here
contents: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '8'
- name: Install xmlstarlet
run: sudo apt-get install -y xmlstarlet
- name: Build with Gradle
run: |
bash ./gradlew build
bash ./gradlew publishToMavenLocal
- name: List build directory for debugging
run: ls -R ~/.m2
- name: Extract version from generated POM file
id: extract_version
run: |
xml_file=$(find ~/.m2/repository/org/tdf/ -type f -name "*.pom" -print -quit)
VERSION=$(xmlstarlet sel -N xmlns="http://maven.apache.org/POM/4.0.0" -t -v "//xmlns:project/xmlns:version" "$xml_file")
GROUPID=$(xmlstarlet sel -N xmlns="http://maven.apache.org/POM/4.0.0" -t -v "//xmlns:project/xmlns:groupId" "$xml_file" | sed 's/\./\//g')
ARTIFACTID=$(xmlstarlet sel -N xmlns="http://maven.apache.org/POM/4.0.0" -t -v "//xmlns:project/xmlns:artifactId" "$xml_file")
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "GROUPID=$GROUPID" >> $GITHUB_ENV
echo "ARTIFACTID=$ARTIFACTID" >> $GITHUB_ENV
- name: Checkout artifact repo
uses: actions/checkout@v4
with:
repository: 'RiV-chain/artifact'
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.MAVEN_PAT }}
- name: Create package directories
run: |
mkdir -p ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}
- name: Copy JAR, POM, SHA-1, and MD5 files
run: |
cp -r ~/.m2/repository/org .
mv ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/maven-metadata-local.xml ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/maven-metadata.xml
sha1sum ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.jar > ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.jar.sha1
md5sum ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.jar > ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.jar.md5
sha1sum ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.pom > ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.pom.sha1
md5sum ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.pom > ${{ env.GROUPID }}/${{ env.ARTIFACTID }}/${{ env.VERSION }}/${{ env.ARTIFACTID }}-${{ env.VERSION }}.pom.md5
- name: Commit and push files
run: |
git config user.name "vikulin"
git config user.email "[email protected]"
git add .
git commit -m "Add build artifacts for version ${{ env.VERSION }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.MAVEN_PAT }}
repository: RiV-chain/artifact
force_with_lease: true