diff --git a/.drone.yml b/.drone.yml index 62a30ca7c..edc82def0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,80 +1,127 @@ +# .drone.yml --- kind: pipeline -type: kubernetes -name: linux-amd64 -platform: - os: linux +type: docker +name: amd64-main +node_selector: # Ensure this runs on an amd64 runner arch: amd64 -node_selector: - kubernetes.io/arch: amd64 -trigger: - event: - - tag - - push +trigger: # Only run on pushes to the main branch + event: [ push ] + branch: [ main ] steps: -- name: docker +- name: build_push_amd64_latest + image: plugins/docker # Use Docker plugin to build and push image + settings: + repo: bottledpills/deluge-openvpn + tags: + - latest-linux-amd64 # Tag for amd64 variant (main branch → "latest") + username: + from_secret: docker_username # Docker registry credentials (secret) + password: + from_secret: docker_password + +--- +kind: pipeline +type: docker +name: arm64-main +node_selector: # Ensure this runs on an arm64 runner + arch: arm64 +trigger: # Only run on pushes to the main branch + event: [ push ] + branch: [ main ] +steps: +- name: build_push_arm64_latest image: plugins/docker settings: - dockerfile: docker/Dockerfile.amd64 + repo: bottledpills/deluge-openvpn + tags: + - latest-linux-arm64 # Tag for arm64 variant (main branch → "latest") username: from_secret: docker_username password: from_secret: docker_password - repo: bottledpills/deluge-openvpn - auto_tag: true - auto_tag_suffix: linux-amd64 - platform: 'linux/amd64' --- kind: pipeline -type: kubernetes -name: linux-arm64 -platform: - os: linux - arch: arm64 +type: docker +name: amd64-tag node_selector: - kubernetes.io/arch: arm64 -trigger: - event: - - tag - - push + arch: amd64 +trigger: # Only run on creation of Git tags (releases) + event: [ tag ] steps: -- name: docker +- name: build_push_amd64_version image: plugins/docker settings: - dockerfile: docker/Dockerfile.arm64 + repo: bottledpills/deluge-openvpn + # Use Drone env substitution to strip the leading "v" from the tag [oai_citation_attribution:0‡docs.drone.io](https://docs.drone.io/pipeline/environment/substitution/#:~:text=,0) + tags: + - ${DRONE_TAG##v}-linux-amd64 # e.g. "v2.0.1" → "2.0.1-linux-amd64" username: from_secret: docker_username password: from_secret: docker_password - repo: bottledpills/deluge-openvpn - auto_tag: true - auto_tag_suffix: linux-arm64 - platform: 'linux/arm64' --- kind: pipeline -type: kubernetes -name: manifest -platform: - os: linux - arch: arm64 +type: docker +name: arm64-tag node_selector: - kubernetes.io/arch: arm64 -trigger: - event: - - tag - - push + arch: arm64 +trigger: # Only run on creation of Git tags (releases) + event: [ tag ] steps: -- name: manifest +- name: build_push_arm64_version + image: plugins/docker + settings: + repo: bottledpills/deluge-openvpn + tags: + - ${DRONE_TAG##v}-linux-arm64 # e.g. "v2.0.1" → "2.0.1-linux-arm64" + username: + from_secret: docker_username + password: + from_secret: docker_password + +--- +kind: pipeline +type: docker +name: manifest-main +# The manifest step can run on either architecture; we'll use amd64 for consistency +node_selector: + arch: amd64 +trigger: # Run on main branch pushes (to create "latest" manifest) + event: [ push ] + branch: [ main ] +depends_on: # Wait for both arch images to be built and pushed + - amd64-main + - arm64-main +steps: +- name: push_manifest_latest + image: plugins/manifest # Drone manifest plugin to create multi-arch manifest + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + spec: docker/manifest.tmpl # Use external manifest template for tags and images + +--- +kind: pipeline +type: docker +name: manifest-tag +node_selector: + arch: amd64 +trigger: # Run on tag events (to create versioned manifest) + event: [ tag ] +depends_on: + - amd64-tag + - arm64-tag +steps: +- name: push_manifest_version image: plugins/manifest settings: - spec: docker/manifest.tmpl username: from_secret: docker_username password: from_secret: docker_password - ignore_missing: true -depends_on: - - linux-amd64 - - linux-arm64 + spec: docker/manifest.tmpl # Same template handles both latest and version tags \ No newline at end of file diff --git a/docker/manifest.tmpl b/docker/manifest.tmpl index 3bb473750..473a2bc38 100644 --- a/docker/manifest.tmpl +++ b/docker/manifest.tmpl @@ -1,10 +1,14 @@ +# docker/manifest.tmpl image: bottledpills/deluge-openvpn:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}} + manifests: - - image: bottledpills/deluge-openvpn:{{#if build.tag}}{{trimPrefix "v" build.tag}}-linux-amd64{{else}}latest-linux-amd64{{/if}} - platform: - architecture: amd64 - os: linux - - image: bottledpills/deluge-openvpn:{{#if build.tag}}{{trimPrefix "v" build.tag}}-linux-arm64{{else}}latest-linux-arm64{{/if}} - platform: - architecture: arm64 - os: linux +- image: bottledpills/deluge-openvpn:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64 + platform: + architecture: amd64 + os: linux + +- image: bottledpills/deluge-openvpn:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64 + platform: + architecture: arm64 + os: linux + variant: v8 \ No newline at end of file