Add github workflow to publish the MM to github package #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish meta-model Eclipse Plugins to GitHub Packages | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - "**" | |
| tags: | |
| - "*" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: write | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
| steps: | |
| # ------------------------------ | |
| # Checkout | |
| # ------------------------------ | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # ------------------------------ | |
| # Setup Java & Maven | |
| # ------------------------------ | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: maven | |
| # ------------------------------ | |
| # Build with Tycho | |
| # ------------------------------ | |
| - name: Build using Maven (Tycho) | |
| run: | | |
| cd is-designer/releng | |
| # mvn -f ./org.obeonetwork.is.designer.parent -DskipTests clean verify | |
| # ------------------------------ | |
| # Install all Eclipse-plugin JARs locally | |
| # ------------------------------ | |
| - name: Install all plugin JARs into local Maven repo | |
| run: | | |
| cd releng/jar-for-github-publish | |
| mkdir -p local-maven-repo | |
| install_jars() { | |
| GROUP_ID="$1" | |
| JAR_PATHS="$2" | |
| for jar_path in $JAR_PATHS; do | |
| echo "Installing $jar_path" | |
| ARTIFACT_ID=$(basename "$jar_path" | sed 's/_.*//') | |
| VERSION=$(basename "$jar_path" | sed -n 's/.*_\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p') | |
| mvn install:install-file \ | |
| -Dfile="$jar_path" \ | |
| -DgroupId="$GROUP_ID" \ | |
| -DartifactId="$ARTIFACT_ID" \ | |
| -Dversion="$VERSION" \ | |
| -Dpackaging=jar \ | |
| -DgeneratePom=true \ | |
| -DlocalRepositoryPath=local-maven-repo | |
| done | |
| } | |
| ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.environment_|org.obeonetwork.dsl.environment.edit_)") | |
| install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS" | |
| ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.entity_|org.obeonetwork.dsl.entity.edit_)") | |
| install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS" | |
| ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.technicalid_|org.obeonetwork.dsl.technicalid.edit_)") | |
| install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS" | |
| ENTITY_JAR_PATHS=$(ls | grep -E ".*net4j.util_") | |
| install_jars org.eclipse.emf.cdo "$ENTITY_JAR_PATHS" | |
| ENTITY_JAR_PATHS=$(ls | grep -E "(.*cdo_|linux.*cdo.common_)") | |
| install_jars org.eclipse.net4j.util "$ENTITY_JAR_PATHS" | |
| # ------------------------------ | |
| # Publish to GitHub Packages | |
| # ------------------------------ | |
| - name: Deploy all installed artifacts to GitHub Packages | |
| env: | |
| GITHUB_USER: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cd releng/jar-for-github-publish | |
| for pom in $(find local-maven-repo -name "*.pom"); do | |
| echo "Found POM: $pom" | |
| ARTIFACT_DIR=$(dirname "$pom") | |
| FILE_JAR=$(ls "$ARTIFACT_DIR"/*.jar | head -n 1) | |
| echo "Found JAR: $FILE_JAR" | |
| # mvn deploy:deploy-file \ | |
| # -DrepositoryId=github \ | |
| # -Durl="https://maven.pkg.github.com/${{ github.repository }}" \ | |
| # -Dfile="$FILE_JAR" \ | |
| # -DpomFile="$pom" \ | |
| # -DgroupId="$GROUP_ID" \ | |
| # -DartifactId="$ARTIFACT_ID" \ | |
| # -Dversion="$VERSION" \ | |
| # -Dpackaging=jar \ | |
| # -DgeneratePom=false \ | |
| # -Dtoken=${{ secrets.GITHUB_TOKEN }} | |
| done |