diff --git a/.woodpecker.yml b/.woodpecker.yml index 4b955bc..207a527 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -11,6 +11,9 @@ pipeline: commands: - curl -L https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.33/swagger-codegen-cli-3.0.33.jar > swagger-codegen-cli.jar - curl -L https://github.com/google/google-java-format/releases/download/v1.15.0/google-java-format-1.15.0-all-deps.jar > google-java-format.jar + when: + event: [ push, pull_request, tag, cron ] + cron: sync # Generate code and docs from official swagger template generate: @@ -26,6 +29,9 @@ pipeline: --config config.json --lang java --output ./generated/ + when: + event: [ push, pull_request, tag, cron ] + cron: sync # Format generated and custom code according to the Google Java Style Guide format: @@ -33,6 +39,9 @@ pipeline: commands: - java -jar google-java-format.jar --replace $(find ./generated/ -name "*.java") - java -jar google-java-format.jar --replace $(find ./custom/ -name "*.java") + when: + event: [ push, pull_request, tag, cron ] + cron: sync # Recreate directories and copy files of previous pipeline step combine: @@ -41,12 +50,18 @@ pipeline: - mkdir --verbose --parents ./src/main/java/ && cp --verbose --recursive ./generated/src/main/java/* ./src/main/java/ - mkdir --verbose --parents ./docs/ && cp --verbose --recursive ./generated/docs/* ./docs/ - mkdir --verbose --parents ./src/ && cp --verbose --recursive ./custom/src/* ./src/ + when: + event: [ push, pull_request, tag, cron ] + cron: sync # Check if generated code can be compiled at language level 8 build: image: openjdk:8 commands: - ./gradlew clean assemble + when: + event: [ push, pull_request, tag, cron ] + cron: sync # Upload updated code to repository publish: @@ -80,4 +95,5 @@ pipeline: fi when: branch: main - event: [ push, tag ] + event: [ push, tag, cron ] + cron: sync