This repository was archived by the owner on Apr 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
121 lines (107 loc) · 4.47 KB
/
Copy pathmodule_workflow.yaml
File metadata and controls
121 lines (107 loc) · 4.47 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Build & Publish Module Workflow
run-name: 'Build & Publish Module -- ${{github.event.inputs.module}}'
on:
workflow_dispatch:
inputs:
module:
type: choice
description: Module
options:
- --SELECT--
- activej-bytebuf
- activej-common
- antlr4-runtime
- auto-service
- bugsplat
- directory-watcher
- eclipse-collections
- eclipse-collections-api
- guava
- httpclient
- httpcore
- httpmime
- javax-inject
- jgit
- jheaps
- jsr305
- mvstore
- ontology-model
- protobuf-java
- reactive-streams
- record-builder-core
- roaringbitmap
- snorocket
required: true
env:
GITHUB_MODULE_DIR: /home/runner/work/${{github.event.repository.name}}/${{github.event.repository.name}}/${{github.event.inputs.module}}
SELF_HOSTED_MODULE_DIR: /home/ec2-user/actions-runner/_work/${{github.event.repository.name}}/${{github.event.repository.name}}/${{github.event.inputs.module}}
MAVEN_SETTING: '/home/ec2-user/maven/.m2/settings.xml'
PUBLISH_OWNER: 'ikmdev'
jobs:
build-publish:
name: Build & Publish
runs-on: ubuntu-24.04
env:
JAVA_VERSION: '21'
steps:
- name: Fail if --SELECT-- chosen
if: github.event.inputs.module == '--SELECT--'
run: |
echo "Please pick a valid module"
exit 1
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{env.JAVA_VERSION}}
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{secrets.GPG_KEY}}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Maven Build
run: |
../mvnw clean install \
-Dmaven.build.cache.enabled=false \
--batch-mode \
-e \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
working-directory: ${{env.GITHUB_MODULE_DIR}}
- name: Get jar count
id: set-jar-count
run: |
find ./target -maxdepth 1 -type f -name '*[!-javadoc][!-sources].jar' -exec jar tf {} \; | grep -c 'dev.ikm.jpms' | xargs
size=$(find ./target -maxdepth 1 -type f -name '*[!-javadoc][!-sources].jar' -exec jar tf {} \; | grep -c 'dev.ikm.jpms' | xargs )
working-directory: ${{env.GITHUB_MODULE_DIR}}
- name: The demo step has failed
env:
MIN_ALLOWED_ENTRIES: 1
if: ${{ steps.set-jar-count.size >= fromJSON(env.MIN_ALLOWED_ENTRIES) }}
run: exit 1
- name: Deploy Artifacts To Nexus
uses: ikmdev/maven-nexus-deploy-action@v1.1.0
with:
nexus_repo_password: ${{secrets.EC2_NEXUS_PASSWORD}}
repo_name: ${{github.event.workflow_run.head_repository.full_name}}
branch_name: ${{github.event.workflow_run.head_branch}}
working_directory: ${{env.GITHUB_MODULE_DIR}}
- name: Publish to OSSRH Maven Central
run: |
../mvnw deploy \
--batch-mode \
-e \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-DskipTests \
-DskipITs \
-DrepositoryId='maven-releases' \
-DrepositoryIdOSSRH='true' \
-Dmaven.source.skip=true \
-Dmaven.javadoc.skip=true \
-PstageOSSRH
working-directory: ${{env.GITHUB_MODULE_DIR}}
env:
MAVEN_USERNAME: ${{secrets.OSSRH_TOKEN_USER}}
MAVEN_CENTRAL_TOKEN: ${{secrets.OSSRH_TOKEN_PASS}}
MAVEN_GPG_PASSPHRASE: ${{secrets.GPG_PASSPHRASE}}