Skip to content

Commit 4465497

Browse files
committed
Add javadoc and sources
1 parent ddf6fe4 commit 4465497

File tree

1 file changed

+106
-104
lines changed

1 file changed

+106
-104
lines changed

.github/workflows/publish.yml

Lines changed: 106 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -6,126 +6,128 @@ on:
66
pull_request:
77
branches: [ "main" ]
88
release:
9-
types: [created]
9+
types: [ created ]
1010

1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- name: Checkout repository
17-
uses: actions/checkout@v4
18-
19-
- name: Set up JDK 17
20-
uses: actions/setup-java@v3
21-
with:
22-
distribution: 'temurin'
23-
java-version: '17'
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
2418

25-
- name: Build with Maven
26-
run: mvn clean package
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v3
21+
with:
22+
distribution: 'temurin'
23+
java-version: '17'
2724

28-
- name: Upload plugin artifact
29-
uses: actions/upload-artifact@v4
30-
with:
31-
name: Plugin
32-
path: target/${{ github.event.repository.name }}-*.jar
25+
- name: Build with Maven
26+
run: mvn clean package
3327

34-
- name: Get Plugin Version
35-
id: version
36-
run: echo "VERSION=$(basename $(ls target/${{ github.event.repository.name }}-*.jar | grep -vE '(-sources|-javadoc).jar') .jar | sed 's/${{ github.event.repository.name }}-//')" >> $GITHUB_ENV
28+
- name: Upload plugin artifact
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: Plugin
32+
path: target/${{ github.event.repository.name }}-*.jar
3733

38-
- name: Delete existing GitHub release (if exists)
39-
run: |
40-
RELEASE_ID=$(gh release view ${{ env.VERSION }} --json id -q '.id' || echo "")
41-
if [ -n "$RELEASE_ID" ]; then
42-
echo "Deleting existing release..."
43-
gh release delete ${{ env.VERSION }} --yes
44-
fi
45-
env:
46-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Get Plugin Version
35+
id: version
36+
run: echo "VERSION=$(basename $(ls target/${{ github.event.repository.name }}-*.jar | grep -vE '(-sources|-javadoc).jar') .jar | sed 's/${{ github.event.repository.name }}-//')" >> $GITHUB_ENV
4737

48-
- name: Delete existing tag (if exists)
49-
run: |
50-
if git rev-parse "${{ env.VERSION }}" >/dev/null 2>&1; then
51-
echo "Deleting existing tag..."
52-
git tag -d ${{ env.VERSION }}
53-
git push origin :refs/tags/${{ env.VERSION }}
54-
fi
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Delete existing GitHub release (if exists)
39+
run: |
40+
RELEASE_ID=$(gh release view ${{ env.VERSION }} --json id -q '.id' || echo "")
41+
if [ -n "$RELEASE_ID" ]; then
42+
echo "Deleting existing release..."
43+
gh release delete ${{ env.VERSION }} --yes
44+
fi
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5747

58-
- name: Rename & Upload Latest Release
59-
run: |
60-
JAR_FILE=$(ls target/${{ github.event.repository.name }}-*.jar | grep -vE '(-sources|-javadoc).jar' | head -n 1)
61-
cp "$JAR_FILE" target/${{ github.event.repository.name }}-latest.jar
48+
- name: Delete existing tag (if exists)
49+
run: |
50+
if git rev-parse "${{ env.VERSION }}" >/dev/null 2>&1; then
51+
echo "Deleting existing tag..."
52+
git tag -d ${{ env.VERSION }}
53+
git push origin :refs/tags/${{ env.VERSION }}
54+
fi
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6257

63-
- name: Create GitHub Release
64-
uses: softprops/action-gh-release@v1
65-
with:
66-
tag_name: ${{ env.VERSION }}
67-
name: Release ${{ env.VERSION }}
68-
draft: false
69-
prerelease: false
70-
files: |
71-
target/${{ github.event.repository.name }}-latest.jar
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
- name: Rename & Upload Latest Release
59+
run: |
60+
JAR_FILE=$(ls target/${{ github.event.repository.name }}-*.jar | grep -vE '(-sources|-javadoc).jar' | head -n 1)
61+
cp "$JAR_FILE" target/${{ github.event.repository.name }}-latest.jar
7462
75-
- name: Checkout Maven repository
76-
uses: actions/checkout@v4
77-
with:
78-
repository: CroaBeast/repo
79-
path: maven-repo
80-
token: ${{ secrets.MAVEN_DEPLOY_TOKEN }}
81-
82-
- name: Configure Git
83-
run: |
84-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
85-
git config --global user.name "github-actions[bot]"
86-
87-
- name: Deploy to Maven repository
88-
run: |
89-
# Create directory structure
90-
mkdir -p maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}
91-
92-
# Copy JAR file
93-
cp target/${{ github.event.repository.name }}-${{ env.VERSION }}.jar maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}/
94-
95-
# Create POM file
96-
cat > maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}/${{ github.event.repository.name }}-${{ env.VERSION }}.pom << EOF
97-
<?xml version="1.0" encoding="UTF-8"?>
98-
<project>
99-
<modelVersion>4.0.0</modelVersion>
63+
- name: Create GitHub Release
64+
uses: softprops/action-gh-release@v1
65+
with:
66+
tag_name: ${{ env.VERSION }}
67+
name: Release ${{ env.VERSION }}
68+
draft: false
69+
prerelease: false
70+
files: |
71+
target/${{ github.event.repository.name }}-latest.jar
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Checkout Maven repository
76+
uses: actions/checkout@v4
77+
with:
78+
repository: CroaBeast/repo
79+
path: maven-repo
80+
token: ${{ secrets.MAVEN_DEPLOY_TOKEN }}
81+
82+
- name: Configure Git
83+
run: |
84+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
85+
git config --global user.name "github-actions[bot]"
86+
87+
- name: Deploy to Maven repository
88+
run: |
89+
# Create directory structure
90+
mkdir -p maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}
91+
92+
# Copy JAR files
93+
cp target/${{ github.event.repository.name }}-${{ env.VERSION }}.jar maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}/
94+
cp target/${{ github.event.repository.name }}-${{ env.VERSION }}-javadoc.jar maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}/
95+
cp target/${{ github.event.repository.name }}-${{ env.VERSION }}-sources.jar maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}/
96+
97+
# Create POM file
98+
cat > maven-repo/me/croabeast/${{ github.event.repository.name }}/${{ env.VERSION }}/${{ github.event.repository.name }}-${{ env.VERSION }}.pom << EOF
99+
<?xml version="1.0" encoding="UTF-8"?>
100+
<project>
101+
<modelVersion>4.0.0</modelVersion>
102+
<groupId>me.croabeast</groupId>
103+
<artifactId>${{ github.event.repository.name }}</artifactId>
104+
<version>${{ env.VERSION }}</version>
105+
<packaging>jar</packaging>
106+
</project>
107+
EOF
108+
109+
# Update or create maven-metadata.xml
110+
cat > maven-repo/me/croabeast/${{ github.event.repository.name }}/maven-metadata.xml << EOF
111+
<?xml version="1.0" encoding="UTF-8"?>
112+
<metadata>
100113
<groupId>me.croabeast</groupId>
101114
<artifactId>${{ github.event.repository.name }}</artifactId>
102-
<version>${{ env.VERSION }}</version>
103-
<packaging>jar</packaging>
104-
</project>
105-
EOF
106-
107-
# Update or create maven-metadata.xml
108-
cat > maven-repo/me/croabeast/${{ github.event.repository.name }}/maven-metadata.xml << EOF
109-
<?xml version="1.0" encoding="UTF-8"?>
110-
<metadata>
111-
<groupId>me.croabeast</groupId>
112-
<artifactId>${{ github.event.repository.name }}</artifactId>
113-
<versioning>
114-
<latest>${{ env.VERSION }}</latest>
115-
<release>${{ env.VERSION }}</release>
116-
<versions>
117-
<version>${{ env.VERSION }}</version>
118-
</versions>
119-
<lastUpdated>$(date +%Y%m%d%H%M%S)</lastUpdated>
120-
</versioning>
121-
</metadata>
122-
EOF
123-
124-
# Commit and push changes
125-
cd maven-repo
126-
git add .
127-
git commit -m "Deploy ${{ github.event.repository.name }} ${{ env.VERSION }}"
128-
git push
115+
<versioning>
116+
<latest>${{ env.VERSION }}</latest>
117+
<release>${{ env.VERSION }}</release>
118+
<versions>
119+
<version>${{ env.VERSION }}</version>
120+
</versions>
121+
<lastUpdated>$(date +%Y%m%d%H%M%S)</lastUpdated>
122+
</versioning>
123+
</metadata>
124+
EOF
125+
126+
# Commit and push changes
127+
cd maven-repo
128+
git add .
129+
git commit -m "Deploy ${{ github.event.repository.name }} ${{ env.VERSION }}"
130+
git push
129131
130132
env:
131133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)