79 lines
1.9 KiB
YAML
79 lines
1.9 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: ci
|
|
|
|
steps:
|
|
- name: setup
|
|
image: debian:12
|
|
volumes:
|
|
- name: docker
|
|
path: /var/lib/docker
|
|
- name: usrbin
|
|
path: /usr/bin
|
|
- name: dockersocket
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- apt-get update && apt-get install -y curl # install dependencies from apt
|
|
- curl -fsSL https://get.docker.com -o get-docker.sh # install docker
|
|
- sh ./get-docker.sh
|
|
- docker buildx create --name ${DRONE_COMMIT_SHA}${DRONE_BUILD_NUMBER} --use
|
|
- sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/bin # install task
|
|
# - task build # build the docker image
|
|
- name: build
|
|
image: debian:12
|
|
volumes:
|
|
- name: docker
|
|
path: /var/lib/docker
|
|
- name: usrbin
|
|
path: /usr/bin
|
|
- name: dockersocket
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- tag=$${DRONE_TAG:-$DRONE_BRANCH} # set tag to tag name (if applicable) or branch name
|
|
- task build TAG=$tag # build the docker image
|
|
- name: publish tag
|
|
image: debian:12
|
|
environment:
|
|
PASSOWRD:
|
|
from_secret: FORGEJO_PASSWORD
|
|
volumes:
|
|
- name: docker
|
|
path: /var/lib/docker
|
|
- name: usrbin
|
|
path: /usr/bin
|
|
- name: dockersocket
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- docker login -u drone -p ${PASSWORD}
|
|
- tag=$${DRONE_TAG:-$DRONE_BRANCH} # set tag to tag name (if applicable) or branch name
|
|
- task push TAG=$tag
|
|
when:
|
|
event:
|
|
- tag
|
|
- name: publish main
|
|
image: debian:12
|
|
environment:
|
|
PASSOWRD:
|
|
from_secret: FORGEJO_PASSWORD
|
|
volumes:
|
|
- name: docker
|
|
path: /var/lib/docker
|
|
- name: usrbin
|
|
path: /usr/bin
|
|
- name: dockersocket
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- docker login -u drone -p ${PASSWORD}
|
|
- task push TAG=main
|
|
when:
|
|
branch:
|
|
- main
|
|
|
|
volumes:
|
|
- name: dockersocket
|
|
host:
|
|
path: /var/run/docker.sock
|
|
- name: docker
|
|
temp: {}
|
|
- name: usrbin
|
|
temp: {} |