index : static-web-server.git

ascending towards madness

---
kind: pipeline
type: docker
name: development

platform:
  os: linux
  arch: amd64

steps:
- name: restore-cache
  image: drillster/drone-volume-cache
  volumes:
    - name: cache
      path: /cache
  settings:
    restore: true
    mount:
      - ./target

- name: test
  image: joseluisq/rust-linux-darwin-builder:1.50.0
  commands:
    - make test

- name: rebuild-cache
  image: drillster/drone-volume-cache
  volumes:
    - name: cache
      path: /cache
  settings:
    rebuild: true
    mount:
      - ./target

volumes:
  - name: cache
    host:
      path: /tmp/cache

trigger:
  event:
    - push
    - pull_request
  branch:
    - master
    - develop
    - feature/*
    - bugfix/*
    - hotfix/*
    - 1.x



---
kind: pipeline
type: docker
name: production

platform:
  os: linux
  arch: amd64

steps:
- name: test
  image: joseluisq/rust-linux-darwin-builder:1.50.0
  commands:
    - make test
  when:
    event:
    - tag

- name: release
  image: joseluisq/rust-linux-darwin-builder:1.50.0
  commands:
    - make prod.release

- name: publish-scratch
  image: joseluisq/drone-docker
  privileged: true
  settings:
    registry: registry.joseluisq.net
    repo: registry.joseluisq.net/static-web-server
    dockerfile: ./docker/scratch/Dockerfile
    username:
      from_secret: registry_username
    password:
      from_secret: registry_password
    build_args:
      - SERVER_VERSION=${DRONE_TAG##v}
    auto_tag: true
    auto_tag_aliases:
      - latest

- name: publish-alpine
  image: joseluisq/drone-docker
  privileged: true
  settings:
    registry: registry.joseluisq.net
    repo: registry.joseluisq.net/static-web-server
    dockerfile: ./docker/alpine/Dockerfile
    username:
      from_secret: registry_username
    password:
      from_secret: registry_password
    build_args:
      - SERVER_VERSION=${DRONE_TAG##v}
    auto_tag: true
    auto_tag_suffix: alpine

- name: github-release
  image: plugins/github-release
  settings:
    api_key:
      from_secret: github_token
    files:
      - ./bin/*.tar.gz
      - ./bin/*-SHA256SUM
    title: ${DRONE_TAG}
    draft: true

- name: publish-public-scratch
  image: joseluisq/drone-docker
  privileged: true
  settings:
    repo: joseluisq/static-web-server
    dockerfile: ./docker/scratch/Dockerfile
    username:
      from_secret: dockerhub_username
    password:
      from_secret: dockerhub_password
    build_args:
      - SERVER_VERSION=${DRONE_TAG##v}
    auto_tag: true
    auto_tag_aliases:
      - latest

- name: publish-public-alpine
  image: joseluisq/drone-docker
  privileged: true
  settings:
    repo: joseluisq/static-web-server
    dockerfile: ./docker/alpine/Dockerfile
    username:
      from_secret: dockerhub_username
    password:
      from_secret: dockerhub_password
    build_args:
      - SERVER_VERSION=${DRONE_TAG##v}
    auto_tag: true
    auto_tag_suffix: alpine

trigger:
  ref:
    include:
    - refs/tags/v*
    exclude:
    - refs/tags/**rc**
    - refs/tags/**alpha**
    - refs/tags/**beta**
    - refs/tags/**latest**
    - refs/tags/**dev**



---
kind: pipeline
type: docker
name: staging

platform:
  os: linux
  arch: amd64

steps:
- name: test
  image: joseluisq/rust-linux-darwin-builder:1.50.0
  commands:
    - make test

- name: release
  image: joseluisq/rust-linux-darwin-builder:1.50.0
  commands:
    - make prod.release

- name: publish-scratch
  image: joseluisq/drone-docker
  privileged: true
  settings:
    registry: registry.joseluisq.net
    repo: registry.joseluisq.net/static-web-server
    dockerfile: ./docker/scratch/Dockerfile
    username:
      from_secret: registry_username
    password:
      from_secret: registry_password
    tags:
      - v1-dev

- name: publish-alpine
  image: joseluisq/drone-docker
  privileged: true
  settings:
    registry: registry.joseluisq.net
    repo: registry.joseluisq.net/static-web-server
    dockerfile: ./docker/alpine/Dockerfile
    username:
      from_secret: registry_username
    password:
      from_secret: registry_password
    tags:
      - v1-dev-alpine

trigger:
  target:
  - staging



---
kind: pipeline
type: docker
name: notification

platform:
  os: linux
  arch: amd64

steps:
- name: notify
  image: plugins/slack
  settings:
    webhook:
      from_secret: slack_webhook
    channel: ci-cd

depends_on:
- development
- staging
- production

trigger:
  status:
  - success
  - failure