Skip to content

Commit 7e61eb7

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 7e61eb7

4 files changed

Lines changed: 105 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Publish meta-model Eclipse Plugins to GitHub Packages
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "**"
8+
paths:
9+
- "releng/jar-for-github-publish/**"
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+
# Install all Eclipse-plugin JARs locally
40+
# ------------------------------
41+
- name: Install all plugin JARs into local Maven repo
42+
run: |
43+
cd releng/jar-for-github-publish
44+
mkdir -p local-maven-repo
45+
46+
install_jars() {
47+
GROUP_ID="$1"
48+
JAR_PATHS="$2"
49+
50+
for jar_path in $JAR_PATHS; do
51+
echo "Installing $jar_path"
52+
53+
ARTIFACT_ID=$(basename "$jar_path" | sed 's/_.*//')
54+
VERSION=$(basename "$jar_path" | sed -n 's/.*_\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')
55+
56+
57+
mvn install:install-file \
58+
-Dfile="$jar_path" \
59+
-DgroupId="$GROUP_ID" \
60+
-DartifactId="$ARTIFACT_ID" \
61+
-Dversion="$VERSION" \
62+
-Dpackaging=jar \
63+
-DgeneratePom=true \
64+
-DlocalRepositoryPath=local-maven-repo
65+
done
66+
}
67+
68+
ENTITY_JAR_PATHS=$(ls | grep -E ".*net4j.util_")
69+
install_jars org.eclipse.net4j.util "$ENTITY_JAR_PATHS"
70+
71+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(cdo_|cdo.common_)")
72+
install_jars org.eclipse.emf.cdo "$ENTITY_JAR_PATHS"
73+
# ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.environment_|org.obeonetwork.dsl.environment.edit_)")
74+
# install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
75+
76+
# ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.entity_|org.obeonetwork.dsl.entity.edit_)")
77+
# install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
78+
79+
# ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.technicalid_|org.obeonetwork.dsl.technicalid.edit_)")
80+
# install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
81+
82+
# ------------------------------
83+
# Publish to GitHub Packages
84+
# ------------------------------
85+
- name: Deploy all installed artifacts to GitHub Packages
86+
env:
87+
GITHUB_USER: ${{ github.actor }}
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
run: |
90+
cd releng/jar-for-github-publish
91+
for pom in $(find local-maven-repo -name "*.pom"); do
92+
echo "Found POM: $pom"
93+
ARTIFACT_DIR=$(dirname "$pom")
94+
FILE_JAR=$(ls "$ARTIFACT_DIR"/*.jar | head -n 1)
95+
echo "Found JAR: $FILE_JAR"
96+
97+
mvn deploy:deploy-file \
98+
-DrepositoryId=github \
99+
-Durl="https://maven.pkg.github.com/${{ github.repository }}" \
100+
-Dfile="$FILE_JAR" \
101+
-DpomFile="$pom" \
102+
-Dpackaging=jar \
103+
-DgeneratePom=false \
104+
-Dtoken=${{ secrets.GITHUB_TOKEN }}
105+
done
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)