diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..28d6d7b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,22 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + # Run it at a specific time so that we don't get emails all day long + time: "00:00" + open-pull-requests-limit: 10 + ignore: + - dependency-name: "*" + # GitHub actions are using git tags (v1 = v1.2 = v1.2.3) which should be compatible until a major change is performed + update-types: + - "version-update:semver-minor" + - "version-update:semver-patch" +- package-ecosystem: maven + directory: "/" + schedule: + interval: daily + # Run it at a specific time so that we don't get emails all day long + time: "00:00" + open-pull-requests-limit: 10 diff --git a/.github/workflows/checkBuild.yml b/.github/workflows/checkBuild.yml new file mode 100644 index 0000000..0259de3 --- /dev/null +++ b/.github/workflows/checkBuild.yml @@ -0,0 +1,100 @@ +name: Check Build + +on: + workflow_dispatch: + push: + branches: [ develop ] + paths-ignore: + - '**.md' + pull_request: + branches: [ develop ] + paths-ignore: + - '**.md' + +jobs: + build_lts: + runs-on: ubuntu-latest + + strategy: + matrix: + java: [11] #, 17-ea] + java-package: [jdk] + distribution: [adopt] + include: + # When building Java 8 we need JavaFX on JDK basis + - java: 8 + java-package: jdk+fx + distribution: zulu + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: ${{ matrix.distribution }} + java-version: ${{ matrix.java }} + java-package: ${{ matrix.java-package }} + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build with Maven + run: mvn -B clean verify -P java${{ matrix.java }} + + - name: Check for uncommited changes + run: | + if [[ "$(git status --porcelain)" != "" ]]; then + echo ---------------------------------------- + echo git status + echo ---------------------------------------- + git status + echo ---------------------------------------- + echo git diff + echo ---------------------------------------- + git diff + echo ---------------------------------------- + echo Troubleshooting + echo ---------------------------------------- + echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean verify" + exit 1 + fi + + - uses: actions/upload-artifact@v2 + with: + name: jars-lts-${{ matrix.java }} + path: target/*.jar + + build_xdev_ide: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '8' + java-package: jdk+fx + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build with Maven + run: mvn -B clean verify -Pjava8,xdev-ide + + - uses: actions/upload-artifact@v2 + with: + name: jars-xdev-ide + path: target/*.jar diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..14510fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,282 @@ +name: Release + +on: + push: + branches: [ master ] + +jobs: + check_code: # Validates the code (see checkBuild.yml) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '8' + java-package: jdk+fx + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build with Maven + run: mvn -B clean verify -Pjava8 + + - name: Check for uncommited changes + run: | + if [[ "$(git status --porcelain)" != "" ]]; then + echo ---------------------------------------- + echo git status + echo ---------------------------------------- + git status + echo ---------------------------------------- + echo git diff + echo ---------------------------------------- + git diff + echo ---------------------------------------- + echo Troubleshooting + echo ---------------------------------------- + echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean verify" + exit 1 + fi + + prepare_release: + runs-on: ubuntu-latest + needs: [check_code] + outputs: + upload_url: ${{ steps.create_draft.outputs.upload_url }} + steps: + - uses: actions/checkout@v2 + + - name: Configure Git + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + - name: Un-SNAP + run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false + + - name: Get version + id: version + # Ignores the suffix + run: | + read_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + parts=(${read_version//-/ }) + echo "::set-output name=release::${parts[0]}" + + - name: Commit and Push + run: | + git add -A + git commit -m "Release ${{ steps.version.outputs.release }}" + git push origin + git tag v${{ steps.version.outputs.release }} + git push origin --tags + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ steps.version.outputs.release }} + release_name: v${{ steps.version.outputs.release }} + commitish: master + body: | + ## Installation [![Maven Central](https://img.shields.io/maven-central/v/com.xdev-software/xapi-fx?versionPrefix=${{ steps.version.outputs.release }})](https://mvnrepository.com/artifact/com.xdev-software/xapi-fx) + Add the following lines to your pom: + ```XML + + com.xdev-software + xapi-fx + ${{ steps.version.outputs.release }}-java + + ``` + draft: false + prerelease: false + + publish_central: # Publish the code to central + runs-on: ubuntu-latest + needs: [prepare_release] + strategy: + matrix: + java: [11] #, 17] + java-package: [jdk] + distribution: [adopt] + include: + # When building Java 8 we need JavaFX on JDK basis + - java: 8 + java-package: jdk+fx + distribution: zulu + steps: + - uses: actions/checkout@v2 + + - name: Init Git and pull + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git pull + + - name: Set up JDK and configure for ossrh + uses: actions/setup-java@v2 + with: # running setup-java again overwrites the settings.xml + distribution: ${{ matrix.distribution }} + java-version: ${{ matrix.java }} + java-package: ${{ matrix.java-package }} + server-id: ossrh + server-username: MAVEN_CENTRAL_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + + - name: Publish to Apache Maven Central + run: mvn -B deploy -Possrh,java${{ matrix.java }} + env: + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + publish-pages: + # Java 8-variant has no dependencies + name: Publish dependencies and licenses to github pages (Java 11) + runs-on: ubuntu-latest + needs: [prepare_release] + steps: + - uses: actions/checkout@v2 + + - name: Init Git and pull + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git pull + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + java-package: jdk + + - name: Restore - Maven Cache + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven-: + + - name: Build dependencies/licenses files + run: mvn -B project-info-reports:dependencies -Pjava8 + + - name: Upload licenses - Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: dependencies-licenses + path: target/site + + - name: Generate docs/dependencies dir + run: mkdir -p docs/dependencies + + - name: Move built files into docs/dependencies + run: mv target/site/* docs/dependencies + + - name: Rename dependencies.html to index.html + working-directory: docs/dependencies + run: mv dependencies.html index.html + + - name: Copy Readme into docs (as index.md) + run: cp README.md docs/index.md + + - name: Configure Pages + working-directory: docs + run: |- + echo "theme: jekyll-theme-tactile" > _config.yml + + - name: Deploy to Github pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + enable_jekyll: true + + build_xdev_ide: + runs-on: ubuntu-latest + needs: [prepare_release] + steps: + - uses: actions/checkout@v2 + + - name: Init Git and pull + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git pull + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '8' + java-package: jdk+fx + + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build with Maven + run: mvn -B clean verify -Pjava8,xdev-ide + + - uses: actions/upload-artifact@v2 + with: + name: jars-xdev-ide + path: target/*.jar + + after_release: + runs-on: ubuntu-latest + needs: [publish_central, build_xdev_ide] + steps: + - uses: actions/checkout@v2 + + - name: Init Git and pull + run: | + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git pull + + - name: Inc Version and SNAP root + # The versions plugin doesn't work that easily with maven so there are some workarounds + run: | + echo "Setting version without suffix" + read_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + parts=(${read_version//-/ }) + mvn versions:set -DnewVersion=${parts[0]} -DgenerateBackupPoms=false + + echo "Incrementing version and set snapshot" + mvn versions:set -DnextSnapshot=true -DgenerateBackupPoms=false + + echo "Set version with suffix" + read_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + parts=(${read_version//-/ }) + mvn versions:set -DnewVersion="${parts[0]}-{version.suffix}-${parts[1]}" -DgenerateBackupPoms=false + + - name: Git Commit and Push + run: | + git add -A + git commit -m "Preparing for next development iteration" + git push origin + + - name: pull-request + uses: repo-sync/pull-request@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + destination_branch: "develop" + pr_title: "Sync back" + pr_body: "An automated PR to sync changes back" diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml new file mode 100644 index 0000000..fab6856 --- /dev/null +++ b/.github/workflows/test-deploy.yml @@ -0,0 +1,41 @@ +name: Test Deployment + +on: + workflow_dispatch: + +jobs: + publish_central: # Publish the code to central + runs-on: ubuntu-latest + + strategy: + matrix: + java: [11] #, 17-ea] + java-package: [jdk] + distribution: [adopt] + include: + # When building Java 8 we need JavaFX on JDK basis + - java: 8 + java-package: jdk+fx + distribution: zulu + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK and configure for ossrh + uses: actions/setup-java@v2 + with: # running setup-java again overwrites the settings.xml + distribution: ${{ matrix.distribution }} + java-version: ${{ matrix.java }} + java-package: ${{ matrix.java-package }} + server-id: ossrh + server-username: MAVEN_CENTRAL_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + + - name: Publish to Apache Maven Central + run: mvn -B deploy -Possrh,java${{ matrix.java }} + env: + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/pom.xml b/pom.xml index 41bf200..bf8f72f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.xdev-software xapi-fx - 1.0.0_${version.suffix}-SNAPSHOT + 1.0.0-${version.suffix}-SNAPSHOT jar XDEV Application Framework JavaFX @@ -405,4 +405,4 @@ - \ No newline at end of file +