Skip to content

Commit 3b30ad6

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 3b30ad6

10 files changed

Lines changed: 117 additions & 0 deletions

.github/workflows/publish.yml

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