-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
126 additions
and
0 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,95 @@ | ||
--- | ||
name: Java CI | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
paths: | ||
- 'plugin/**' | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- 'plugin/**' | ||
release: | ||
types: | ||
- published | ||
paths: | ||
- 'plugin/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
maven: | ||
uses: ./.github/workflows/maven.yml | ||
if: github.repository_owner == 'epam' | ||
|
||
release-snapshot-to-maven-central: | ||
name: Publish SNAPSHOT package to MavenCentral | ||
environment: release-snapshot | ||
if: github.repository_owner == 'epam' && github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
needs: build-java | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
server-id: ossrh | ||
server-username: OSS_SONATYPE_USERNAME | ||
server-password: OSS_SONATYPE_TOKEN | ||
cache: 'maven' | ||
settings-path: ${{ github.workspace }} | ||
- name: Set SNAPSHOT in version | ||
run: | | ||
syndicate_plugin_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file ./plugin/pom.xml | xargs) | ||
mvn versions:set -DnewVersion="${syndicate_plugin_version}-SNAPSHOT" --file ./plugin/pom.xml | ||
mvn versions:commit --file ./plugin/pom.xml | ||
- name: Build with Maven | ||
run: mvn -B package --file ./plugin/pom.xml | ||
- name: Deploy development version binaries (Snapshots) | ||
env: | ||
OSS_SONATYPE_USERNAME: ${{ vars.OSSRH_USERNAME }} | ||
OSS_SONATYPE_TOKEN: ${{ secrets.OSSRH_TOKEN }} | ||
run: | | ||
echo Checking variables ${{ secrets.OSSRH_USERNAME }} | ||
cat $GITHUB_WORKSPACE/settings.xml | ||
mvn clean deploy -B --file ./plugin/pom.xml --settings $GITHUB_WORKSPACE/settings.xml | ||
# Upload to MavenCentral on every GitHub Release | ||
release-to-maven-central: | ||
name: Publish released package to MavenCentral | ||
environment: release-maven-central | ||
if: github.repository_owner == 'epam' && github.event.action == 'published' | ||
runs-on: ubuntu-latest | ||
needs: build-java | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Maven Central Repository | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
server-id: ossrh | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
cache: 'maven' | ||
- name: Build with Maven | ||
run: mvn -B package --file ./plugin/pom.xml | ||
- name: Publish to Maven Central | ||
run: | | ||
# -U force updates just to make sure we are using latest dependencies | ||
# -B Batch mode (do not ask for user input), just in case | ||
# -P activate profile | ||
mvn -U -B clean deploy -P release --file ./plugin/pom.xml | ||
env: | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} |
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: Build and Run Tests by Maven | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
build-java: | ||
name: "maven-compile (${{ matrix.os }}, JDK-${{ matrix.jdk }}), Distribution ${{ matrix.distribution }}" | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
jdk: [ 17, 21 ] | ||
distribution: [ corretto, oracle ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK ${{ matrix.jdk }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.jdk }} | ||
distribution: ${{ matrix.distribution }} | ||
cache: "maven" | ||
- name: Build with Maven | ||
run: mvn -B package --file ./plugin/pom.xml |
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