diff --git a/.woodpecker.yml b/.woodpecker/build-and-publish.yml
similarity index 67%
rename from .woodpecker.yml
rename to .woodpecker/build-and-publish.yml
index 5d46a51..f867ba7 100644
--- a/.woodpecker.yml
+++ b/.woodpecker/build-and-publish.yml
@@ -1,38 +1,35 @@
+when:
+  - event: tag
+
 clone:
   git:
     image: woodpeckerci/plugin-git
     tags: true
 
 steps:
-  tests:
-    image: brenard/python-pre-commit:latest
-    commands:
-      - DEBIAN_FRONTEND=noninteractive apt-get -qq update < /dev/null > /dev/null
-      - DEBIAN_FRONTEND=noninteractive apt-get -qq -y install --no-install-recommends python3-requests < /dev/null > /dev/null
-      - pre-commit run --all-files
-
   build:
     image: brenard/debian-python-deb
-    when:
-      event: tag
-    depends_on: [tests]
     commands:
       - echo "$GPG_KEY"|base64 -d|gpg --import
       - ./build.sh --quiet
-    secrets: [maintainer_name, maintainer_email, gpg_key, debian_codename]
+    environment:
+      MAINTAINER_NAME:
+        from_secret: maintainer_name
+      MAINTAINER_EMAIL:
+        from_secret: maintainer_email
+      GPG_KEY:
+        from_secret: gpg_key
+      DEBIAN_CODENAME:
+        from_secret: debian_codename
 
   publish-dryrun:
     image: alpine
-    when:
-      event: tag
     depends_on: [build]
     commands:
       - ls dist/* dist/check-woodpecker-upgrade-*/check_woodpecker_upgrade
 
   publish-gitea:
     image: plugins/gitea-release
-    when:
-      event: tag
     depends_on: [build]
     settings:
       api_key:
@@ -48,8 +45,6 @@ steps:
 
   publish-apt:
     image: brenard/aptly-publish
-    when:
-      event: tag
     depends_on: [build]
     settings:
       api_url:
diff --git a/.woodpecker/tests.yml b/.woodpecker/tests.yml
new file mode 100644
index 0000000..bf66171
--- /dev/null
+++ b/.woodpecker/tests.yml
@@ -0,0 +1,11 @@
+when:
+  - event: push
+    branch: main
+
+steps:
+  tests:
+    image: brenard/python-pre-commit:latest
+    commands:
+      - DEBIAN_FRONTEND=noninteractive apt-get -qq update < /dev/null > /dev/null
+      - DEBIAN_FRONTEND=noninteractive apt-get -qq -y install --no-install-recommends python3-requests < /dev/null > /dev/null
+      - pre-commit run --all-files