Compare commits
6 Commits
d21fba0fc1
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d8168c726 | |||
| 381d149cd2 | |||
| 3b572491d0 | |||
| 452d525d83 | |||
| 8153df0b90 | |||
| af349ca4d6 |
@ -11,7 +11,13 @@ jobs:
|
|||||||
build-deploy:
|
build-deploy:
|
||||||
runs-on: act_runner_java
|
runs-on: act_runner_java
|
||||||
if: ${{ github.event.pull_request.merged == true }}
|
if: ${{ github.event.pull_request.merged == true }}
|
||||||
|
env:
|
||||||
|
JAVA_HOME: /usr/lib/jvm/java-21-openjdk
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
run: |
|
||||||
|
git clone ${{ github.server_url }}/${{ github.repository }}.git .
|
||||||
|
git checkout ${{ github.sha }}
|
||||||
- name: Set up environment
|
- name: Set up environment
|
||||||
run: |
|
run: |
|
||||||
echo "PR #${{ github.event.number }} merged into master"
|
echo "PR #${{ github.event.number }} merged into master"
|
||||||
@ -23,7 +29,7 @@ jobs:
|
|||||||
- name: Build project
|
- name: Build project
|
||||||
run: |
|
run: |
|
||||||
mvn -B -DskipTests clean package source:jar javadoc:jar
|
mvn -B -DskipTests clean package source:jar javadoc:jar
|
||||||
- name: Deploy
|
- name: Deploy to Nexus
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
if [ -z "${{ secrets.NEXUS_USERNAME }}" ] || [ -z "${{ secrets.NEXUS_PASSWORD }}" ]; then
|
if [ -z "${{ secrets.NEXUS_USERNAME }}" ] || [ -z "${{ secrets.NEXUS_PASSWORD }}" ]; then
|
||||||
@ -59,25 +65,11 @@ jobs:
|
|||||||
-Djavadoc="$javadoc_jar" \
|
-Djavadoc="$javadoc_jar" \
|
||||||
-DpomFile="./pom.xml" \
|
-DpomFile="./pom.xml" \
|
||||||
-Durl="https://nexus.imyeyu.com/repository/maven-releases/" \
|
-Durl="https://nexus.imyeyu.com/repository/maven-releases/" \
|
||||||
-DrepositoryId="timi-nexus"
|
-DrepositoryId="timi-nexus" \
|
||||||
- name: Upload jar artifact
|
-Dhttps.protocols=TLSv1.2 \
|
||||||
if: success()
|
-Djdk.tls.client.protocols=TLSv1.2
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: build-jar
|
|
||||||
path: target/*.jar
|
|
||||||
if-no-files-found: error
|
|
||||||
create-release:
|
|
||||||
runs-on: act_runner_base
|
|
||||||
needs: build-deploy
|
|
||||||
if: ${{ success() && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'master' && startsWith(github.event.pull_request.title, 'v') }}
|
|
||||||
steps:
|
|
||||||
- name: Download jar artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: build-jar
|
|
||||||
path: dist
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
|
if: ${{ success() && startsWith(github.event.pull_request.title, 'v') }}
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.RUNNER_TOKEN }}
|
||||||
GITEA_SERVER_URL: ${{ github.server_url }}
|
GITEA_SERVER_URL: ${{ github.server_url }}
|
||||||
@ -104,16 +96,13 @@ jobs:
|
|||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$payload")
|
-d "$payload")
|
||||||
release_id=$(echo "$response" | sed -n 's/.*"id":[ ]*\\([0-9][0-9]*\\).*/\\1/p' | head -n 1)
|
release_id=$(echo "$response" | grep -o '"id":[0-9]*' | head -n 1 | grep -o '[0-9]*')
|
||||||
if [ -z "$release_id" ]; then
|
if [ -z "$release_id" ] || echo "$response" | grep -q '"message"'; then
|
||||||
echo "Create release failed: $response"
|
echo "Create release failed: $response"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! ls dist/*.jar >/dev/null 2>&1; then
|
echo "Release created: id=$release_id"
|
||||||
echo "Missing jar artifact in dist"
|
for asset_path in target/*.jar; do
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
for asset_path in dist/*.jar; do
|
|
||||||
asset_name=$(basename "$asset_path")
|
asset_name=$(basename "$asset_path")
|
||||||
curl -sS -X POST "$api_url/$release_id/assets?name=$asset_name" \
|
curl -sS -X POST "$api_url/$release_id/assets?name=$asset_name" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
|||||||
18
pom.xml
18
pom.xml
@ -27,29 +27,11 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>3.3.1</version>
|
<version>3.3.1</version>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-sources</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>jar-no-fork</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.11.2</version>
|
<version>3.11.2</version>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-javadocs</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|||||||
Reference in New Issue
Block a user