Skip to content

Commit f53948f

Browse files
committed
Add github workflow to publish the MM to github package
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
1 parent 35039a0 commit f53948f

10 files changed

+104
-0
lines changed

.github/workflows/publish.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Publish meta-model Eclipse Plugins to GitHub Packages
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
paths:
8+
- "releng/jar-for-github-publish/**"
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
id-token: write
17+
packages: write
18+
19+
steps:
20+
# ------------------------------
21+
# Checkout
22+
# ------------------------------
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
# ------------------------------
27+
# Setup Java & Maven
28+
# ------------------------------
29+
- name: Set up JDK 17
30+
uses: actions/setup-java@v4
31+
with:
32+
distribution: temurin
33+
java-version: 17
34+
cache: maven
35+
36+
# ------------------------------
37+
# Install all Eclipse-plugin JARs locally
38+
# ------------------------------
39+
- name: Install all plugin JARs into local Maven repo
40+
run: |
41+
cd releng/jar-for-github-publish
42+
mkdir -p local-maven-repo
43+
44+
install_jars() {
45+
GROUP_ID="$1"
46+
JAR_PATHS="$2"
47+
48+
for jar_path in $JAR_PATHS; do
49+
echo "Installing $jar_path"
50+
51+
ARTIFACT_ID=$(basename "$jar_path" | sed 's/_.*//')
52+
VERSION=$(basename "$jar_path" | sed -n 's/.*_\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')
53+
54+
55+
mvn install:install-file \
56+
-Dfile="$jar_path" \
57+
-DgroupId="$GROUP_ID" \
58+
-DartifactId="$ARTIFACT_ID" \
59+
-Dversion="$VERSION" \
60+
-Dpackaging=jar \
61+
-DgeneratePom=true \
62+
-DlocalRepositoryPath=local-maven-repo
63+
done
64+
}
65+
66+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.environment_|org.obeonetwork.dsl.environment.edit_)")
67+
install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
68+
69+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.entity_|org.obeonetwork.dsl.entity.edit_)")
70+
install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
71+
72+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.technicalid_|org.obeonetwork.dsl.technicalid.edit_)")
73+
install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
74+
75+
ENTITY_JAR_PATHS=$(ls | grep -E ".*net4j.util_")
76+
install_jars org.eclipse.net4j.util "$ENTITY_JAR_PATHS"
77+
78+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(cdo_|cdo.common_)")
79+
install_jars org.eclipse.emf.cdo "$ENTITY_JAR_PATHS"
80+
81+
# ------------------------------
82+
# Publish to GitHub Packages
83+
# ------------------------------
84+
- name: Deploy all installed artifacts to GitHub Packages
85+
env:
86+
GITHUB_USER: ${{ github.actor }}
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
run: |
89+
cd releng/jar-for-github-publish
90+
for pom in $(find local-maven-repo -name "*.pom"); do
91+
echo "Found POM: $pom"
92+
ARTIFACT_DIR=$(dirname "$pom")
93+
FILE_JAR=$(ls "$ARTIFACT_DIR"/*.jar | head -n 1)
94+
echo "Found JAR: $FILE_JAR"
95+
96+
mvn deploy:deploy-file \
97+
-DrepositoryId=github \
98+
-Durl="https://maven.pkg.github.com/${{ github.repository }}" \
99+
-Dfile="$FILE_JAR" \
100+
-DpomFile="$pom" \
101+
-Dpackaging=jar \
102+
-DgeneratePom=false \
103+
-Dtoken=${{ secrets.GITHUB_TOKEN }}
104+
done
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)