labels:
  type: exec
  platform: linux/amd64

steps:
- name: generate-manifest
  image: bash
  commands:
  - sed -i "s/registry.drycc.cc/$${DRYCC_REGISTRY}/g" .woodpecker/manifest-run.tmpl
  - sed -i "s/registry.drycc.cc/$${DRYCC_REGISTRY}/g" .woodpecker/manifest-build.tmpl
  - sed -i "s/{{codename}}/$${CODENAME}/g" .woodpecker/manifest-run.tmpl
  - sed -i "s/{{codename}}/$${CODENAME}/g" .woodpecker/manifest-build.tmpl
  secrets:
  - codename
  - dev_registry
  - drycc_registry
  - container_username
  - container_password
  when:
    event:
    - push
    - tag
    - cron

- name: publish-run-image
  image: bash
  commands:
  - podman run --rm
    -e PLUGIN_SPEC=.woodpecker/manifest-run.tmpl
    -e PLUGIN_USERNAME=$CONTAINER_USERNAME
    -e PLUGIN_PASSWORD=$CONTAINER_PASSWORD
    -e DRONE_TAG=$CI_COMMIT_TAG
    -v $(pwd):$(pwd)
    -w $(pwd)
    docker.io/plugins/manifest
  secrets:
  - container_username
  - container_password
  when:
    event:
    - push
    - tag
    - cron

- name: publish-build-image
  image: bash
  commands:
  - podman run --rm
    -e PLUGIN_SPEC=.woodpecker/manifest-build.tmpl
    -e PLUGIN_USERNAME=$CONTAINER_USERNAME
    -e PLUGIN_PASSWORD=$CONTAINER_PASSWORD
    -e DRONE_TAG=$CI_COMMIT_TAG
    -v $(pwd):$(pwd)
    -w $(pwd)
    docker.io/plugins/manifest
  secrets:
  - container_username
  - container_password
  when:
    event:
    - push
    - tag
    - cron

depends_on:
- build-linux-pack
