-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish maven artifacts to GH Packages (#305)
Provide reusable maven ci workflow. Publish `maven-conf` and `org.eclipse.theia.cloud.common`. Publish `org.eclipse.theia.cloud.operator` and `org.eclipse.theia.cloud.service`. Always resolve `maven-conf` and `org.eclipse.theia.cloud.common` locally. Update `actions/setup-java@v3` to `actions/setup-java@v4`. Remove the service tests, as they are indirectly run via the maven build.
- Loading branch information
Showing
7 changed files
with
207 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Maven org.eclipse.theia.cloud.common CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/**" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/**" | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
call-reusable-maven-workflow: | ||
permissions: | ||
packages: write | ||
uses: ./.github/workflows/reusable-maven.yml | ||
with: | ||
path_to_package: common/org.eclipse.theia.cloud.common/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Maven config CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/maven-conf/**" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/maven-conf/**" | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
call-reusable-maven-workflow: | ||
permissions: | ||
packages: write | ||
uses: ./.github/workflows/reusable-maven.yml | ||
with: | ||
path_to_package: common/maven-conf/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Maven org.eclipse.theia.cloud.operator CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/**" | ||
- "java/operator/org.eclipse.theia.cloud.operator/**" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/**" | ||
- "java/operator/org.eclipse.theia.cloud.operator/**" | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
call-reusable-maven-workflow: | ||
permissions: | ||
packages: write | ||
uses: ./.github/workflows/reusable-maven.yml | ||
with: | ||
path_to_package: operator/org.eclipse.theia.cloud.operator/ | ||
dependencies: common/maven-conf/,common/org.eclipse.theia.cloud.common/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Maven org.eclipse.theia.cloud.service CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/**" | ||
- "java/service/org.eclipse.theia.cloud.service/**" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "java/common/**" | ||
- "java/service/org.eclipse.theia.cloud.service/**" | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
call-reusable-maven-workflow: | ||
permissions: | ||
packages: write | ||
uses: ./.github/workflows/reusable-maven.yml | ||
with: | ||
path_to_package: service/org.eclipse.theia.cloud.service/ | ||
dependencies: common/maven-conf/,common/org.eclipse.theia.cloud.common/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Reusable workflow for maven packages | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
path_to_package: | ||
required: true | ||
type: string | ||
dependencies: | ||
description: "List of paths to dependencies. Entries are relative to the java directory and separated by comma (no whitespaces)." | ||
required: false | ||
type: string | ||
|
||
defaults: | ||
run: | ||
working-directory: java | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "17" | ||
distribution: "temurin" | ||
|
||
- name: Build dependencies | ||
if: ${{ inputs.dependencies != '' }} | ||
run: | | ||
IFS=',' read -r -a dirs <<< "${{ inputs.dependencies }}" | ||
for dir in "${dirs[@]}" | ||
do | ||
cd "$dir" | ||
mvn clean install --no-transfer-progress | ||
cd - | ||
done | ||
- name: Verify package | ||
run: | | ||
cd ${{ inputs.path_to_package }} | ||
mvn verify -fae --no-transfer-progress | ||
check-version: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' || github.event_name == 'release' | ||
outputs: | ||
is_snapshot_version: ${{ steps.version_check.outputs.is_snapshot_version }} | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- id: version_check | ||
run: | | ||
cd ${{ inputs.path_to_package }} | ||
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
if [[ "$VERSION" == *-SNAPSHOT ]]; then | ||
echo "is_snapshot_version=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "is_snapshot_version=false" >> $GITHUB_OUTPUT | ||
fi | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: check-version | ||
if: (github.event_name == 'push' && needs.check-version.outputs.is_snapshot_version == 'true') || (github.event_name == 'release' && needs.check-version.outputs.is_snapshot_version == 'false') | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "17" | ||
distribution: "temurin" | ||
|
||
- name: Build dependencies | ||
if: ${{ inputs.dependencies != '' }} | ||
run: | | ||
IFS=',' read -r -a dirs <<< "${{ inputs.dependencies }}" | ||
for dir in "${dirs[@]}" | ||
do | ||
cd "$dir" | ||
mvn clean install --no-transfer-progress | ||
cd - | ||
done | ||
- name: Publish package | ||
run: | | ||
cd ${{ inputs.path_to_package }} | ||
mvn --batch-mode deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains 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