diff --git a/.github/actions/build.yml b/.github/actions/build.yml new file mode 100644 index 0000000..2b1f0f2 --- /dev/null +++ b/.github/actions/build.yml @@ -0,0 +1,103 @@ +name: Continous Integration + +on: + pull_request: + push: + branches: + - master + tags: 'v[0-9]+.[0-9]+.[0-9]+' + paths-ignore: + - './idea' + - 'README.md' + - 'LICENSE' + - '.github/**' + - '!.github/workflows/**' + +env: + java: 1.8 + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: '${{ env.java }}' + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Spotless + run: mvn -B spotless:check + - name: Build + run: mvn package -B -DskipTests=true + - name: Copy artifact + run: mkdir staging && cp target/*.jar staging + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: plugin + path: staging + + release: + needs: [build, test] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Get tag + id: get_version + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.get_version.outputs.VERSION }} + release_name: Release ${{ steps.get_version.outputs.VERSION }} + draft: false + prerelease: false + - name: Download pre-build artifact + uses: actions/download-artifact@v2 + with: + name: plugin + path: staging + - name: Get artifact name + id: get_artifact_name + run: | + cd staging + echo ::set-output name=ARTIFACT::$(ls *.jar) + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: staging/${{ steps.get_artifact_name.outputs.ARTIFACT }} + asset_name: ${{ steps.get_artifact_name.outputs.ARTIFACT }} + asset_content_type: application/zip + + test: + runs-on: ubuntu-latest + steps: + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: '${{ env.java }}' + - uses: actions/checkout@v2 + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Tests + run: mvn -B test diff --git a/pom.xml b/pom.xml index ddab76e..819e8d7 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,7 @@ 2.176.1 8 + 2.4.2 + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + origin/master + + + + + src/main/java/**/*.java + + + java,javax,org,com,de + + + + ${basedir}/spotless-style.xml + + + + + + repo.jenkins-ci.org diff --git a/spotless-style.xml b/spotless-style.xml new file mode 100644 index 0000000..42c74b7 --- /dev/null +++ b/spotless-style.xml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +