# config

config_hash: 277bdad82a0dceb99feb559ca4995ca1da71f919eb0ca3aaf444cf2b0669af7e
config_name: drone
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make deps
        - make test

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - ./.drone.sh
      when:
        event: [ push, tag ]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: sh .cli.sh

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [ docker_username, docker_password ]
      tag: [ latest ]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [ docker_username, docker_password ]
      tag: [ latest ]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

  #  release-server-alpine:
  #    image: plugins/docker
  #    repo: woodpeckerci/woodpecker-server
  #    dockerfile: Dockerfile.alpine
  #    secrets: [ docker_username, docker_password ]
  #    tag: "${DRONE_TAG}-alpine"
  #    when:
  #      event: tag
  #
  #  release-agent-alpine:
  #    image: plugins/docker
  #    repo: woodpeckerci/woodpecker-agent
  #    dockerfile: Dockerfile.agent.alpine
  #    secrets: [ docker_username, docker_password ]
  #    tag: "${DRONE_TAG}-alpine"
  #    when:
  #      event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [ docker_username, docker_password ]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [ docker_username, docker_password ]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: eb2bfaab61aad24029f5d86032d1b5efaa0520f8e0bcb7c1344e601fb2c4ee18
config_name: drone
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make deps
        - make test

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - ./.drone.sh
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: sh .cli.sh

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    #  release-server-alpine:
    #    image: plugins/docker
    #    repo: woodpeckerci/woodpecker-server
    #    dockerfile: Dockerfile.alpine
    #    secrets: [ docker_username, docker_password ]
    #    tag: "${DRONE_TAG}-alpine"
    #    when:
    #      event: tag
    #
    #  release-agent-alpine:
    #    image: plugins/docker
    #    repo: woodpeckerci/woodpecker-agent
    #    dockerfile: Dockerfile.agent.alpine
    #    secrets: [ docker_username, docker_password ]
    #    tag: "${DRONE_TAG}-alpine"
    #    when:
    #      event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 668406fd95c977bf7a6d8def43db51682121ba02bf2aff40c90aa403305127a8
config_name: drone
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make deps
        - make test
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - ./.drone.sh
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: sh .cli.sh

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    #  release-server-alpine:
    #    image: plugins/docker
    #    repo: woodpeckerci/woodpecker-server
    #    dockerfile: Dockerfile.alpine
    #    secrets: [ docker_username, docker_password ]
    #    tag: "${DRONE_TAG}-alpine"
    #    when:
    #      event: tag
    #
    #  release-agent-alpine:
    #    image: plugins/docker
    #    repo: woodpeckerci/woodpecker-agent
    #    dockerfile: Dockerfile.agent.alpine
    #    secrets: [ docker_username, docker_password ]
    #    tag: "${DRONE_TAG}-alpine"
    #    when:
    #      event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 48204586499658392f90158d45eb5f841d474fd4a843c20d97dff956216d9833
config_name: drone
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make deps
        - make test
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - ./.drone.sh
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: sh .cli.sh

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 54010994cd3a3b666b6d2b0b85bf372305cbc423d8e902185cb2d89d2291b8ad
config_name: drone
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make deps
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - ./.drone.sh
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: sh .cli.sh

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: bedfbba5eef9ea917d8db3ef2d5110911f51963f5adc331181318f0ca5c5478f
config_name: drone
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make deps
        - make test
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: sh .cli.sh

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 556d8f866119f689f023e1f0ad2d3ddd34615dc1f9fb15ce51eecc5bee5bf8d2
config_name: drone
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make deps
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 57257e2ced2a47d004ce9c889a0665a83df5606905aea31c64cd34fbb8a4a115
config_name: woodpecker/release-docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - GITHUB_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$GITHUB_PRIVATE_KEY > $HOME/.ssh/id_rsa"
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path: "docs/*"

    deploy-docs-review:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn global add surge
        - yarn build
        - surge build/
      when:
        event: [pull_request]
        path: "docs/*"


config_hash: f45e89a8fb575509fd70ba707328ba306a57726ec8c4af613d7656f5579fa3c7
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: b70f383c15eb7a781b05d23ac091d2319f2a6f5a321be9d24ea456b861584534
config_name: woodpecker/.release
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    fetch:
      image: docker:git
      commands:
        - git fetch --tags
        - git status
      when:
        event: push
        branch: master

    prepare-release:
      image: node:14-alpine
      secrets: [github_token]
      commands:
        - apk add git
        - npm i semantic-release @semantic-release/exec
        - npx semantic-release --dry-run
      when:
        event: push
        branch: master

    prepare-build:
      image: golang:1.16
      commands:
        - export WOODPECKER_VERSION=$(cat ./woodpecker-version)
        - echo "Version $WOODPECKER_VERSION"
        - test "v-$WOODPECKER_VERSION" != "v-" || exit 0
        - go mod tidy
        - go get github.com/woodpecker-ci/togo
        - cd web/
        - go generate ./...
      when:
        event: push
        branch: master

    build:
      image: ghcr.io/goreleaser/goreleaser:v0.174.1
      commands:
        - export WOODPECKER_VERSION=$(cat ./woodpecker-version)
        - test "v-$WOODPECKER_VERSION" != "v-" || exit 0
        - export GORELEASER_CURRENT_TAG="$WOODPECKER_VERSION"
        - goreleaser release --skip-validate --rm-dist --skip-publish
      when:
        event: push
        branch: master

    build-docker-server:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=server
      commands:
        - export WOODPECKER_VERSION=$(cat ./woodpecker-version)
        - test "v-$WOODPECKER_VERSION" != "v-" || exit 0
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: push
        branch: master

    build-docker-agent:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=agent
      commands:
        - export WOODPECKER_VERSION=$(cat ./woodpecker-version)
        - test "v-$WOODPECKER_VERSION" != "v-" || exit 0
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: push
        branch: master

    build-docker-cli:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=cli
      commands:
        - export WOODPECKER_VERSION=$(cat ./woodpecker-version)
        - test "v-$WOODPECKER_VERSION" != "v-" || exit 0
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: push
        branch: master

    release:
      image: node:14-alpine
      secrets: [github_token]
      commands:
        - export WOODPECKER_VERSION=$(cat ./woodpecker-version)
        - echo "Version $WOODPECKER_VERSION"
        - apk add git
        # should already be installed by prepare-release
        - npm i semantic-release @semantic-release/exec
        - npx semantic-release
      when:
        event: push
        branch: master

  # TODO
  # depends_on:
  #   - "woodpecker/.test"


config_hash: dffbd5e734bb85d1d214b6b35fce63ac3b3d5428bfea0bccfcf06aabc6c90f3a
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY > $HOME/.ssh/id_rsa"
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path: "docs/*"

    build-docs-pr:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path: "docs/*"


config_hash: 51d2551ea690d8b160ddbd21cf189e82e5c48936aca6609ae2b74e6ab09137be
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 3c849f36d77ac7196016affb98cc84db4e8eca72a92ecd3dedf8656a710d5b21
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - cd web/
        - curl -f https://get.pnpm.io/v6.js | node - add --global pnpm@6
        - pnpm config set store-dir .pnpm-store
        - pnpm install
        - pnpm build

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release
      when:
        event: [push, tag]

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: 608a2cd7c97dfc7e16c905dfb781f78a89a28f4a4a38cd93f8f9b07a0a1a8f3f
config_name: woodpecker/web
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deps:
      image: node:14-alpine
      commands:
        - cd web/
        - curl -f https://get.pnpm.io/v6.js | node - add --global pnpm@6
        - pnpm config set store-dir .pnpm-store
        - pnpm install

    lint:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - pnpm lint

    formatcheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - pnpm formatcheck

    typecheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - pnpm typecheck

    build:
      image: node:14-alpine
      commands:
        - pnpm build


config_hash: 28cb6964eef00b6e021b1e70489c1b398e1708f952475eea4252f6026301509d
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - cd web/
        - curl -f https://get.pnpm.io/v6.js | node - add --global pnpm@6
        - pnpm config set store-dir .pnpm-store
        - pnpm install
        - pnpm build

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: 7f3ce488f995fb183a1140a53eaeb1b16e16465dfe69ba2306cfc49e971fe13f
config_name: woodpecker/web
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deps:
      image: node:14-alpine
      commands:
        - cd web/
        - curl -f https://get.pnpm.io/v6.js | node - add --global pnpm@6
        - pnpm config set store-dir .pnpm-store
        - pnpm install
      when:
        path: "web/*"

    lint:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - pnpm lint
      when:
        path: "web/*"

    formatcheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - pnpm formatcheck
      when:
        path: "web/*"

    typecheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - pnpm typecheck
      when:
        path: "web/*"

    build:
      image: node:14-alpine
      commands:
        - pnpm build
      when:
        path: "web/*"


config_hash: 68fc6cde0165026a5cd1bbc845b0a0a38577f274a9384e7d75cf905199f47a91
config_name: woodpecker/web
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deps:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/*"

    lint:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn lint
      when:
        path: "web/*"

    formatcheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/*"

    typecheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/*"

    build:
      image: node:14-alpine
      commands:
        - yarn build
      when:
        path: "web/*"


config_hash: 2726985b383bd7843a1db8925c8fb5185413b6e73c37802678c89fcb6234f03b
config_name: woodpecker/release
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: golang:1.16
      commands:
        - go mod tidy
        - make release
      when:
        event: [push, tag]
        branch: master

    build-docker-server:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=server
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-agent:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=agent
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-cli:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=cli
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-adk-deb-rpm:
      group: build-docker
      image: golang:1.16
      commands:
        - go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v1.10.3
        - nfpm package --config ./release/nfpm-server.yml --target ./dist --packager apk
        - nfpm package --config ./release/nfpm-server.yml --target ./dist --packager deb
        - nfpm package --config ./release/nfpm-server.yml --target ./dist --packager rpm
        - nfpm package --config ./release/nfpm-agent.yml --target ./dist --packager apk
        - nfpm package --config ./release/nfpm-agent.yml --target ./dist --packager deb
        - nfpm package --config ./release/nfpm-agent.yml --target ./dist --packager rpm
        - nfpm package --config ./release/nfpm-cli.yml --target ./dist --packager apk
        - nfpm package --config ./release/nfpm-cli.yml --target ./dist --packager deb
        - nfpm package --config ./release/nfpm-cli.yml --target ./dist --packager rpm
      when:
        event: [push, tag]
        branch: master

    changelog:
      image: alpine:3.14.1
      commands:
        - apk add make
        - curl -L https://dl.gitea.io/changelog-tool/master/changelog-master-linux-amd64 > changelog
        - chmod +x ./changelog
        - ./changelog -m=$(make version) generate > CHANGELOG-latest.md
        - ./changelog -m=$(make version) contributors >> CHANGELOG-latest.md
        - echo -e "$(cat CHANGELOG-latest.md)\n$(cat CHANGELOG.md)" > CHANGELOG.md
        # TODO push changed CHANGELOG.md with woodpecker-bot
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.apk
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      note: CHANGELOG-latest.md
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  # TODO
  # depends_on:
  #   - test


config_hash: 7fa97d56f351b83e9135ee115769061d05d39c7fba8c513b1c17971ccb69907c
config_name: woodpecker/test
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: d6ca770d95d0b0ebbb43766801cc04dacb2b5bc9107e7a7c97e5248288b30424
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - sed -i "s/<version>/${DRONE_TAG##v}/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/${DRONE_TAG##v}/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag

  depends_on:
    - release


config_hash: a94ca1a26ece1dba76f70c9f225b0bf1c15756276f31037c72c7b58e584bda3b
config_name: woodpecker/release
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: golang:1.16
      commands:
        - go mod tidy
        - make release
      when:
        event: [push, tag]
        branch: master

    build-docker-server:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=server
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-agent:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=agent
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-cli:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=cli
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-adk-deb-rpm:
      group: build-docker
      image: golang:1.16
      commands:
        - go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v1.10.3
        - nfpm package --config ./release/nfpm-server.yml --target ./dist --packager apk
        - nfpm package --config ./release/nfpm-server.yml --target ./dist --packager deb
        - nfpm package --config ./release/nfpm-server.yml --target ./dist --packager rpm
        - nfpm package --config ./release/nfpm-agent.yml --target ./dist --packager apk
        - nfpm package --config ./release/nfpm-agent.yml --target ./dist --packager deb
        - nfpm package --config ./release/nfpm-agent.yml --target ./dist --packager rpm
        - nfpm package --config ./release/nfpm-cli.yml --target ./dist --packager apk
        - nfpm package --config ./release/nfpm-cli.yml --target ./dist --packager deb
        - nfpm package --config ./release/nfpm-cli.yml --target ./dist --packager rpm
      when:
        event: [push, tag]
        branch: master

    changelog:
      image: alpine:3.14.1
      commands:
        - apk add make
        - curl -L https://dl.gitea.io/changelog-tool/master/changelog-master-linux-amd64 > changelog
        - chmod +x ./changelog
        - ./changelog -m=$(make version) generate > CHANGELOG-latest.md
        - ./changelog -m=$(make version) contributors >> CHANGELOG-latest.md
        - echo -e "$(cat CHANGELOG-latest.md)\n$(cat CHANGELOG.md)" > CHANGELOG.md
        # TODO push changed CHANGELOG.md with woodpecker-bot
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.apk
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      note: CHANGELOG-latest.md
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  depends_on:
    - test


config_hash: 1fe625e3958558a4d213d2274ec4061d292f6b23ef1e1c10764a7f0d12f2832b
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY > $HOME/.ssh/id_rsa"
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path: "docs/*"

    build-docs-pr:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path: "docs/*"


config_hash: 8cb9f24cea6f1dc23f70e63d4b2fe3f7d2bc3fa76d2ff8375f19ca66b639c7b9
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path: "docs/*"

    build-docs-pr:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path: "docs/*"


config_hash: f34258b551ac6a341e1058e2e0e3123fc901303e12cdbf3483b3bccc01938895
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path: "docs/*"

    build-docs-pr:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path: "docs/*"


config_hash: de1c203ea0ea15b9933b82472214c1afc2bc6befc01492450ba0e2a0c41aa4e3
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
        - yarn deploy
      when:
        event: [pull_request]
        path: "docs/*"

    build-docs-pr:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path: "docs/*"


config_hash: ebcfa98c7dd71f732feed6b74973b3707f1836da25eab0c8a034fa7f890d0ef8
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
        - yarn deploy


config_hash: 81ca8d4950fbb5ed75e669d1c961c37c043706285b812985d6fd7d0586930d99
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
        - yarn deploy
      when:
        event: push
        path: "docs/*"


config_hash: fc5e53b46ccee68e238bb446e8892ce58497414e52ca07e2a61cb9601d821ef2
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
        - yarn deploy
      when:
        event: push
        path: "docs/*"


config_hash: 867b586df9bf58daf481f903d039424d664895892370b8b9ebc6907488a3321b
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot @obermui.de"
        - git config --global user.name "woodpecker-bot "
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
        - yarn deploy
      when:
        event: push
        path: "docs/*"


config_hash: d75add86ee16fee9c97daf6d471f6125d82b856496532e22f27d0cb90e00f059
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot @obermui.de"
        - git config --global user.name "woodpecker-bot"
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        path: "docs/*"


config_hash: eee7b7c27502057e628ebcf7cf9bdc63306081f8a320b232ad430da45622557d
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path: "docs/*"

    build-docs-pr:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path: "docs/*"


config_hash: 2f287ea50d9a36bfe96b5a3d3284ed9f9c2a26d6e5be720bd3b251144fbf6a41
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - sed -i "s/<version>/${DRONE_TAG##v}/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/${DRONE_TAG##v}/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag

    lint:
      image: alpine/helm:3.5.3
      commands:
        # set some dummy versions so we can lint the helm-charts
        - sed -i "s/<version>/0.0.0/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/0.0.0/g" charts/woodpecker-server/Chart.yaml
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        event: tag

  depends_on:
    - release


config_hash: 60568184016fe89e30de4e9cc531428a0b97bd728a8fd492872b8302ac31f270
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use drone tag or 0.0.0 if not running on a tag
        - export CHART_VERSION=${${DRONE_TAG##v}=0.0.0}
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/*"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/*"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/*"

  depends_on:
    - release


config_hash: df077f8acf6a7bf7053c2ae7e902a4a020f9aaa1d02d3c5b635bdd5d7e5cdca8
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path: "docs/**"

    build-docs-pr:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path: "docs/**"


config_hash: d23a1e8b43727e6370ca612012a20190e5fcbf4bf0b870355fa4ff28956aa178
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/*"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --delete docs/build/ /repo
        - cd /repo
        - git add .
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || exit 0
        - git commit -m "Deploy website - based on ${DRONE_COMMIT_SHA}"
        - git push
      when:
        event: push
        branch: master
        path: "docs/*"


config_hash: d5000e5aac7d3aa5691bf63a558bb0fd28548ac0ad0ab1ae55ec3d02e3e84ba2
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/**"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --delete docs/build/ /repo
        - cd /repo
        - git add .
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || exit 0
        - git commit -m "Deploy website - based on ${DRONE_COMMIT_SHA}"
        - git push
      when:
        event: push
        branch: master
        path: "docs/**"


config_hash: 86551a804746636649840f5fc0b8268f06440b122a569b028bc27517f62751ef
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
  #     - make vet
  #     - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [v0.14]
      when:
        branch: release/v0.14
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [v0.14]
      when:
        branch: release/v0.14
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 27933706be647189fec107f2e9b6d1f149e7cca923fc991c93655892cf5287fe
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/**"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --delete docs/build/ /repo
        - cd /repo
        - git add .
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || exit 0
        - git commit -m "Deploy website - based on ${DRONE_COMMIT_SHA}"
        - git push
      when:
        event: push
        branch: master
        path: "docs/**"


config_hash: 8532fae5f3612436ee4a8695b9ccbfc9ec1932730b174a570febb8eec6f2c0fa
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/**"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --delete docs/build/ /repo
        - cd /repo
        - git add .
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || echo "no change" && exit 0
        - git commit -m "Deploy website - based on ${DRONE_COMMIT_SHA}"
        - echo git push
      when:
        event: push


config_hash: 1fda853dd4be474054837bcb0425576e93e9d6d61f0c8312eed608658ca8345b
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/**"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --delete docs/build/ /repo
        - cd /repo
        - git add .
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || echo "no change" && exit 0
        - git commit -m "Deploy website - based on ${DRONE_COMMIT_SHA}"
        - echo git push
        - git diff HEAD~1 HEAD
      when:
        event: push


config_hash: 2e2c68c6354108e7922ed3dc077ff38bab0d6b2913213acab0b3ad5c4f3ff1c9
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/**"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --delete docs/build/ /repo
        - cd /repo
        - git add .
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || echo "no change" && exit 0
        - git commit -m "Deploy website - based on ${DRONE_COMMIT_SHA}"
        - echo git push
        - pwd && git diff HEAD~1 HEAD
      when:
        event: push


config_hash: b73b5bc418916225c6cb3c8f718d296ea7a571875888a280ed3f5ba5d0df6be8
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 43490bc638667ca9621993922f9d6586f4ed70864300c4295dd1370c3a881c0d
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  branches: master

  pipeline:
    deploy-docs:
      image: node:14-alpine
      secrets:
        - BOT_PRIVATE_KEY
      environment:
        - USE_SSH=true
        - GIT_USER=woodpecker-bot
        - DEPLOYMENT_BRANCH=master
      commands:
        - apk add openssh-client git
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn deploy
      when:
        event: push
        branch: master
        path:
          include: ["docs/**"]
          exclude: ["docs/pipeline-schema/**"]

    test-docs:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [pull_request]
        path:
          include: ["docs/**"]
          exclude: ["docs/pipeline-schema/**"]


config_hash: 976c31eed92980f33ee60037b5f111184ba770c1d7b0fa2c0513f20078a86f35
config_name: woodpecker/json-schema
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test-schema:
      image: golang:1.16
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/pipeline-schema/test
      when:
        path: "server/pipeline-schema/**"


config_hash: 27cab1a61a9ac147c10818002b222d63451ef231937745e49cbc72ff4777fb0e
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/**"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --delete docs/build/ /repo
        - cd /repo
        - git add .
        - git status
        - ls -la
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || exit 0
        - git commit -m "Deploy website - based on ${DRONE_COMMIT_SHA}"
        - echo git push
        - pwd && git diff HEAD~1 HEAD
      when:
        event: push


config_hash: 09601a3660c4bfbb93f7ffdd12a9fa84a66a41fa075bebe19cea03716636cf30
config_name: woodpecker/test
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 03e6feb54ae58056262cf6d8f57a821ed5162a80c7087bd5cd573e2c494ebf62
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use drone tag or 0.0.0 if not running on a tag
        - export CHART_VERSION=${${DRONE_TAG##v}=0.0.0}
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"

  depends_on:
    - release


config_hash: 7c4699776dcee6ac13bed41d6d45400c190009a158aadc5eb58fa87b33b25634
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION=${${DRONE_TAG##v}=0.0.0}
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"

  depends_on:
    - release


config_hash: c586ec8e6b00a36d2174dd769eb87de43660e07bec61d6a580b6902c92bdc567
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION=${${DRONE_TAG##v}=0.0.0}
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    # lint:
    #   image: alpine/helm:3.5.3
    #   commands:
    #     - helm lint charts/woodpecker-agent/
    #     - helm lint charts/woodpecker-server/
    #   when:
    #     path: "charts/**"

    # release:
    #   image: quay.io/helmpack/chart-releaser:v1.2.1
    #   secrets:
    #     - source: github_token
    #       target: CR_TOKEN
    #   commands:
    #     - mkdir -p .cr-index
    #     - cr package charts/woodpecker-server
    #     - cr package charts/woodpecker-agent
    #     - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
    #     - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
    #   when:
    #     event: tag
    #     path: "charts/**"

  depends_on:
    - release


config_hash: 5332af0f27ff4d4bb60d80050ef5b7a3c5fe7e55a3717e985a8e10c79326f6cd
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION="${DRONE_TAG##v}"
        - export CHART_VERSION=$${CHART_VERSION:=0.0.0}
        - echo "Version $CHART_VERSION"
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"

  depends_on:
    - release


config_hash: 899167d9a0fde2e19285278d60110af7208a72962c147e9b483f6ab78ebaefe0
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION="${DRONE_TAG##v}"
        - export CHART_VERSION=$${CHART_VERSION:=0.0.0}
        - echo "Version $CHART_VERSION"
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"


config_hash: 89902ea7f29b137ab56780c321e333bfadaef6d65f72e58b7da343dd588f8338
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  depends_on:
    - test


config_hash: 41dd2733dffb27883ad651b1a55d839593f5e429c0aca309e5cd30fafb6e05e4
config_name: woodpecker/test
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test-format:
      image: golang:1.16
      group: test
      commands:
        - make vet
        - make formatcheck

    test-agent:
      image: golang:1.16
      group: test
      commands:
        - make test-agent

    test-server:
      image: golang:1.16
      group: test
      commands:
        - make test-server

    test-cli:
      image: golang:1.16
      group: test
      commands:
        - make test-cli

    test-lib:
      image: golang:1.16
      group: test
      commands:
        - make test-lib

    lint-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - make lint-frontend

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - make test-frontend

    test-sqlite:
      image: golang:1.16
      group: test
      environment:
        - DATABASE_DRIVER=sqlite3
      commands:
        - make test-server-datastore

    test-postgres:
      image: golang:1.16
      group: test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - make test-server-datastore

    test-mysql:
      image: golang:1.16
      group: test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - make test-server-datastore

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 609d3218d2cecf030a40b4715f6cddf140ba03aa15fc40c07170cee87b00fca2
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 6eb7861b92c2eeeb43c44ee6643655b82e53b9c2e071e89d0334c5403b03a18c
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - cd web/
        - curl -f https://get.pnpm.io/v6.js | node - add --global pnpm@6
        - pnpm config set store-dir .pnpm-store
        - pnpm install
        - pnpm build

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: fb2950273794e2a6264f6be14c4ea3053954fbb06c37b634bda02ca19b71a086
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: e57c5af896b656009b296cb940fbbdf66ba032b9139da531455008cf1fe1cd61
config_name: woodpecker/web
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deps:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

    lint:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn lint
      when:
        path: "web/**"

    formatcheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    typecheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    build:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"


config_hash: 21e5d00540d0ff46e81bef40a581c19d4a2ed73fe14dbcb7ae5894ba6f6f7c21
config_name: woodpecker/web
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    deps:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

    lint:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn lint
      when:
        path: "web/**"

    formatcheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    typecheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    test:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    build:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"


config_hash: 980e425df08d7ac8d2cacfd06087050343f15f8b47c76110b76f23db4d2ecf76
config_name: woodpecker/test
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: c4f7b7541dbe88940b59d426fb1d3095d725b97f8cfb0a15943fb177fbc7dd93
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - (cd web/; go generate ./...)
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: c92d8d4f21ac2910148577da4c5e9ea87a1aa808c87e7bef8136f3bd263135ff
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [ alpine ]
    #   when:
    #     branch: master
    #     event: push

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: Dockerfile.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag
    #
    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: "${DRONE_TAG}-alpine"
    #   when:
    #     event: tag

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: 981c733c44658331e6bc929436303d2cc3b86543fc034297237c45ecb61a7d41
config_name: drone
config_data:
  ---
  kind: pipeline
  name: testing

  platform:
    os: linux
    arch: amd64

  steps:
  - name: vet
    pull: always
    image: golang:1.11
    commands:
    - go vet ./...
    environment:
      GO111MODULE: on
    volumes:
    - name: gopath
      path: /go

  - name: test
    pull: always
    image: golang:1.11
    commands:
    - go test -cover ./...
    environment:
      GO111MODULE: on
    volumes:
    - name: gopath
      path: /go

  volumes:
  - name: gopath
    temp: {}

  trigger:
    ref:
    - refs/heads/master
    - "refs/tags/**"
    - "refs/pull/**"

  ---
  kind: pipeline
  name: linux-amd64

  platform:
    os: linux
    arch: amd64

  steps:
  - name: build-push
    pull: always
    image: golang:1.11
    commands:
    - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-git"
    environment:
      CGO_ENABLED: 0
      GO111MODULE: on
    when:
      event:
        exclude:
        - tag

  - name: build-tag
    pull: always
    image: golang:1.11
    commands:
    - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-git"
    environment:
      CGO_ENABLED: 0
      GO111MODULE: on
    when:
      event:
      - tag

  - name: executable
    pull: always
    image: golang:1.11
    commands:
    - ./release/linux/amd64/drone-git --help

  - name: dryrun
    pull: always
    image: plugins/docker:linux-amd64
    settings:
      daemon_off: false
      dockerfile: docker/Dockerfile.linux.amd64
      dry_run: true
      password:
        from_secret: docker_password
      repo: plugins/git
      tags: linux-amd64
      username:
        from_secret: docker_username
    when:
      event:
      - pull_request

  - name: publish
    pull: always
    image: plugins/docker:linux-amd64
    settings:
      auto_tag: true
      auto_tag_suffix: linux-amd64
      daemon_off: false
      dockerfile: docker/Dockerfile.linux.amd64
      password:
        from_secret: docker_password
      repo: plugins/git
      username:
        from_secret: docker_username
    when:
      event:
        exclude:
        - pull_request

  trigger:
    ref:
    - refs/heads/master
    - "refs/tags/**"
    - "refs/pull/**"

  depends_on:
  - testing

  ---
  kind: pipeline
  name: linux-arm64

  platform:
    os: linux
    arch: arm64

  steps:
  - name: build-push
    pull: always
    image: golang:1.11
    commands:
    - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm64/drone-git"
    environment:
      CGO_ENABLED: 0
      GO111MODULE: on
    when:
      event:
        exclude:
        - tag

  - name: build-tag
    pull: always
    image: golang:1.11
    commands:
    - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm64/drone-git"
    environment:
      CGO_ENABLED: 0
      GO111MODULE: on
    when:
      event:
      - tag

  - name: executable
    pull: always
    image: golang:1.11
    commands:
    - ./release/linux/arm64/drone-git --help

  - name: dryrun
    pull: always
    image: plugins/docker:linux-arm64
    settings:
      daemon_off: false
      dockerfile: docker/Dockerfile.linux.arm64
      dry_run: true
      password:
        from_secret: docker_password
      repo: plugins/git
      tags: linux-arm64
      username:
        from_secret: docker_username
    when:
      event:
      - pull_request

  - name: publish
    pull: always
    image: plugins/docker:linux-arm64
    settings:
      auto_tag: true
      auto_tag_suffix: linux-arm64
      daemon_off: false
      dockerfile: docker/Dockerfile.linux.arm64
      password:
        from_secret: docker_password
      repo: plugins/git
      username:
        from_secret: docker_username
    when:
      event:
        exclude:
        - pull_request

  trigger:
    ref:
    - refs/heads/master
    - "refs/tags/**"
    - "refs/pull/**"

  depends_on:
  - testing

  ---
  kind: pipeline
  name: linux-arm

  platform:
    os: linux
    arch: arm

  steps:
  - name: build-push
    pull: always
    image: golang:1.11
    commands:
    - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/arm/drone-git"
    environment:
      CGO_ENABLED: 0
      GO111MODULE: on
    when:
      event:
        exclude:
        - tag

  - name: build-tag
    pull: always
    image: golang:1.11
    commands:
    - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/arm/drone-git"
    environment:
      CGO_ENABLED: 0
      GO111MODULE: on
    when:
      event:
      - tag

  - name: executable
    pull: always
    image: golang:1.11
    commands:
    - ./release/linux/arm/drone-git --help

  - name: dryrun
    pull: always
    image: plugins/docker:linux-arm
    settings:
      daemon_off: false
      dockerfile: docker/Dockerfile.linux.arm
      dry_run: true
      password:
        from_secret: docker_password
      repo: plugins/git
      tags: linux-arm
      username:
        from_secret: docker_username
    when:
      event:
      - pull_request

  - name: publish
    pull: always
    image: plugins/docker:linux-arm
    settings:
      auto_tag: true
      auto_tag_suffix: linux-arm
      daemon_off: false
      dockerfile: docker/Dockerfile.linux.arm
      password:
        from_secret: docker_password
      repo: plugins/git
      username:
        from_secret: docker_username
    when:
      event:
        exclude:
        - pull_request

  trigger:
    ref:
    - refs/heads/master
    - "refs/tags/**"
    - "refs/pull/**"

  depends_on:
  - testing

  ---
  kind: pipeline
  name: notifications

  platform:
    os: linux
    arch: amd64

  steps:
  - name: manifest
    pull: always
    image: plugins/manifest
    settings:
      auto_tag: true
      ignore_missing: true
      password:
        from_secret: docker_password
      spec: docker/manifest.tmpl
      username:
        from_secret: docker_username

  - name: microbadger
    pull: always
    image: plugins/webhook
    settings:
      urls:
        from_secret: microbadger_url

  trigger:
    ref:
    - refs/heads/master
    - "refs/tags/**"

  depends_on:
  - linux-amd64
  - linux-arm64
  - linux-arm

  ...


config_hash: 95e57f815fa496e804ed898eb5a7436798ad7d834a0f835b95fe40b21d819182
config_name: woodpecker/linux-amd64
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build-push:
      pull: true
      image: golang:1.16
      commands:
        - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-git"
      environment:
        - CGO_ENABLED=0
      when:
        event: push

    build-tag:
      pull: true
      image: golang:1.16
      commands:
        - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-git"
      environment:
        - CGO_ENABLED=0
      when:
        event: tag

  #- name: executable
  #  pull: always
  #  image: golang:1.11
  #  commands:
  #  - ./release/linux/amd64/drone-git --help

  #- name: dryrun
  #  pull: always
  #  image: plugins/docker:linux-amd64
  #  settings:
  #    daemon_off: false
  #    dockerfile: docker/Dockerfile.linux.amd64
  #    dry_run: true
  #    password:
  #      from_secret: docker_password
  #    repo: plugins/git
  #    tags: linux-amd64
  #    username:
  #      from_secret: docker_username
  #  when:
  #    event:
  #    - pull_request

  # publish
  #  pull: always
  #  image: plugins/docker:linux-amd64
  #  settings:
  #    auto_tag: true
  #    auto_tag_suffix: linux-amd64
  #    daemon_off: false
  #    dockerfile: docker/Dockerfile.linux.amd64
  #    password:
  #      from_secret: docker_password
  #    repo: plugins/git
  #    username:
  #      from_secret: docker_username
  #  when:
  #    event:
  #      exclude:
  #      - pull_request

  #trigger:
  #  ref:
  #  - refs/heads/master
  #  - "refs/tags/**"
  #  - "refs/pull/**"

  depends_on:
  - testing


config_hash: a06c77029b96029cb7e60e83370b1766000570f29d2182d6e05c96fe2db23d24
config_name: woodpecker/testing
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    vet:
      pull: true
      image: golang:1.16
      commands:
        - go vet ./...

    test:
      pull: true
      image: golang:1.16
      commands:
        - go test -cover ./...


config_hash: f610ef11f18555279dd6a36e8fc101af014c5072d3ae68b7909202950277bfa9
config_name: woodpecker/linux-amd64
config_data:
  clone:
    git:
      image: docker.io/a6543/test_git_plugin:latest

  pipeline:
    build-push:
      pull: true
      image: golang:1.16
      commands:
        - "go build -v -ldflags \"-X main.version=${DRONE_COMMIT_SHA:0:8}\" -a -tags netgo -o release/linux/amd64/drone-git"
      environment:
        - CGO_ENABLED=0
      when:
        event: push

    build-tag:
      pull: true
      image: golang:1.16
      commands:
        - "go build -v -ldflags \"-X main.version=${DRONE_TAG##v}\" -a -tags netgo -o release/linux/amd64/drone-git"
      environment:
        - CGO_ENABLED=0
      when:
        event: tag

  #- name: executable
  #  pull: always
  #  image: golang:1.11
  #  commands:
  #  - ./release/linux/amd64/drone-git --help

  #- name: dryrun
  #  pull: always
  #  image: plugins/docker:linux-amd64
  #  settings:
  #    daemon_off: false
  #    dockerfile: docker/Dockerfile.linux.amd64
  #    dry_run: true
  #    password:
  #      from_secret: docker_password
  #    repo: plugins/git
  #    tags: linux-amd64
  #    username:
  #      from_secret: docker_username
  #  when:
  #    event:
  #    - pull_request

  # publish
  #  pull: always
  #  image: plugins/docker:linux-amd64
  #  settings:
  #    auto_tag: true
  #    auto_tag_suffix: linux-amd64
  #    daemon_off: false
  #    dockerfile: docker/Dockerfile.linux.amd64
  #    password:
  #      from_secret: docker_password
  #    repo: plugins/git
  #    username:
  #      from_secret: docker_username
  #  when:
  #    event:
  #      exclude:
  #      - pull_request

  #trigger:
  #  ref:
  #  - refs/heads/master
  #  - "refs/tags/**"
  #  - "refs/pull/**"

  depends_on:
  - testing


config_hash: 8ae4b0c25cd6fec9eb9d30f1a336f2c6fae8ac764e6c01f0baa7b8473b235c3c
config_name: woodpecker/testing
config_data:
  clone:
    git:
      image: docker.io/a6543/test_git_plugin:latest

  pipeline:
    vet:
      pull: true
      image: golang:1.16
      commands:
        - go vet ./...

    test:
      pull: true
      image: golang:1.16
      commands:
        - go test -cover ./...


config_hash: b28dc77db1875e247a69d3e63f7042516f6df86406a179d241a7094b2edc9cf3
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: "${DRONE_TAG}-alpine"
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: "${DRONE_TAG}-alpine"
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: b2cc76bec8e3b10ed34498cf967950a538e60db6f8a0a7a2f33b0174dfb59254
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, ${DRONE_TAG}]
      when:
        event: tag

    release-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 15883a2e866fcc4ca04e06bd573e8013cab899b04f66665d1f5eebaef6173d93
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: c2b4960221ebc650d0025e8515e87925083018ba4cf05103bf4f012ee6e33007
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - go get github.com/woodpecker-ci/togo
        - (cd web/; go generate ./...)
        - make release

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 61e1f1e153107436c5f9b17fd412bb309612a2e9972adf0766f57230fdfaae96
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - make release

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: ec397ccba13a4e90175089e35bceb5d1d8e0d7552c2503e5fba968d29ad37029
config_name: woodpecker/release
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: golang:1.16
      commands:
        - make release

    # publish-server:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: docker/Dockerfile.server
    #   secrets: [docker_username, docker_password]
    #   # TODO: only release as next after 0.15.0 got released
    #   tag: [next, latest]
    #   when:
    #     branch: master
    #     event: push

    # publish-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: docker/Dockerfile.server.alpine
    #   secrets: [ docker_username, docker_password ]
    #   # TODO: only release as next-alpine after 0.15.0 got released
    #   tag: [next-alpine, latest-alpine]
    #   when:
    #     branch: master
    #     event: push

    # publish-agent:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: docker/Dockerfile.agent
    #   secrets: [docker_username, docker_password]
    #   # TODO: only release as next after 0.15.0 got released
    #   tag: [next, latest]
    #   when:
    #     branch: master
    #     event: push

    # publish-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: docker/Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   # TODO: only release as next-alpine after 0.15.0 got released
    #   tag: [next-alpine, latest-alpine]
    #   when:
    #     branch: master
    #     event: push

    # release-server:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: docker/Dockerfile.server
    #   secrets: [docker_username, docker_password]
    #   tag: [latest, "${DRONE_TAG}"]
    #   when:
    #     event: tag

    # release-server-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-server
    #   dockerfile: docker/Dockerfile.server.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [latest-alpine, "${DRONE_TAG}-alpine"]
    #   when:
    #     event: tag

    # release-agent:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: docker/Dockerfile.agent
    #   secrets: [docker_username, docker_password]
    #   tag: [latest, "${DRONE_TAG}"]
    #   when:
    #     event: tag

    # release-agent-alpine:
    #   image: plugins/docker
    #   repo: woodpeckerci/woodpecker-agent
    #   dockerfile: docker/Dockerfile.agent.alpine
    #   secrets: [ docker_username, docker_password ]
    #   tag: [latest-alpine, "${DRONE_TAG}-alpine"]
    #   when:
    #     event: tag

    # release-cli:
    #   image: plugins/github-release
    #   files:
    #     - cli/release/woodpecker_*.tar.gz
    #     - cli/release/woodpecker_checksums.txt
    #   secrets:
    #     - source: github_token
    #       target: github_release_api_key
    #   when:
    #     event: tag

    build-docker-server:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=server
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-agent:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=agent
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-cli:
      group: build-docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=cli
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-adk-deb-rpm:
      group: build-docker
      image: golang:1.16
      commands:
        - go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v1.10.3
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager rpm
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager rpm
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager rpm
      when:
        event: [push, tag]
        branch: master

    changelog:
      image: alpine:3.14.1
      commands:
        - apk add make
        - curl -L https://dl.gitea.io/changelog-tool/master/changelog-master-linux-amd64 > changelog
        - chmod +x ./changelog
        - ./changelog -m=$(make version) generate > CHANGELOG-latest.md
        - ./changelog -m=$(make version) contributors >> CHANGELOG-latest.md
        - echo -e "$(cat CHANGELOG-latest.md)\n$(cat CHANGELOG.md)" > CHANGELOG.md
        # TODO push changed CHANGELOG.md with woodpecker-bot
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.apk
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      note: CHANGELOG-latest.md
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  depends_on:
    - test


config_hash: b55749fb63119f53131da613351d2af3446cb0cf997aade9c09b45e8f2d82b81
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build-release:
      image: golang:1.16
      commands:
        - make release

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 66f9701c872d73d8b9316cf992f95af3898ba5e0677687005316db112b2f2a54
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-release:
      image: golang:1.16
      commands:
        - make release

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: c07bd17cb9b400bd37e30b4a04ee34ad4e0ea7cbcfa13ecde7dfd2299d7a2d7f
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 1d9e8da54991b259b77d3d1ae4529032ce40f8e28e551cb43c61afa0deced80a
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    changelog:
      image: alpine:3.14.1
      commands:
        - apk add make
        - curl -L https://dl.gitea.io/changelog-tool/master/changelog-master-linux-amd64 > changelog
        - chmod +x ./changelog
        - ./changelog -m=$(make version) generate > CHANGELOG-latest.md
        - ./changelog -m=$(make version) contributors >> CHANGELOG-latest.md
        - echo -e "$(cat CHANGELOG-latest.md)\n$(cat CHANGELOG.md)" > CHANGELOG.md
        # TODO push updated CHANGELOG.md with woodpecker-bot
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      note: CHANGELOG-latest.md
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 8832620fe016156e4eacda416cc281a69d56ad4cc79b9a6de44ac4a2ef6df975
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 619eaad8834816045195d2d32d67b1fcbeaca0732258856dc5e9d661184fa450
config_name: woodpecker/release
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-docker-server:
      group: bundle
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=server
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-agent:
      group: bundle
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=agent
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-cli:
      group: bundle
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=cli
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-adk-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v1.10.3
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager rpm
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager rpm
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager rpm
      when:
        event: [push, tag]
        branch: master

    changelog:
      image: alpine:3.14.1
      commands:
        - apk add make
        - curl -L https://dl.gitea.io/changelog-tool/master/changelog-master-linux-amd64 > changelog
        - chmod +x ./changelog
        - ./changelog -m=$(make version) generate > CHANGELOG-latest.md
        - ./changelog -m=$(make version) contributors >> CHANGELOG-latest.md
        - echo -e "$(cat CHANGELOG-latest.md)\n$(cat CHANGELOG.md)" > CHANGELOG.md
        # TODO push changed CHANGELOG.md with woodpecker-bot
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.apk
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      note: CHANGELOG-latest.md
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  depends_on:
    - test


config_hash: 53d2e68ab0aab53edbf5fd506118d444a04a7cd30352a3f52c3bd017cc35fae9
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-docker-server:
      group: bundle
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=server
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-agent:
      group: bundle
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=agent
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-cli:
      group: bundle
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=cli
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-adk-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v1.10.3
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-server.yml --target ./dist --packager rpm
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-agent.yml --target ./dist --packager rpm
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager apk
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager deb
        - nfpm package --config ./nfpm/nfpm-cli.yml --target ./dist --packager rpm
      when:
        event: [push, tag]
        branch: master

    changelog:
      image: alpine:3.14.1
      commands:
        - apk add make
        - curl -L https://dl.gitea.io/changelog-tool/master/changelog-master-linux-amd64 > changelog
        - chmod +x ./changelog
        - ./changelog -m=$(make version) generate > CHANGELOG-latest.md
        - ./changelog -m=$(make version) contributors >> CHANGELOG-latest.md
        - echo -e "$(cat CHANGELOG-latest.md)\n$(cat CHANGELOG.md)" > CHANGELOG.md
        # TODO push changed CHANGELOG.md with woodpecker-bot
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.apk
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      note: CHANGELOG-latest.md
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 32ac5fa43a0e8edb8a6efc89f1dafc488f819232d526a4dd8d2f649c07218291
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    build-adk-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.apk
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 47991062e5881b1dce32376b54474009e7521665f2688c54b011b0fa53ba5b80
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-docker-server:
      group: docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=server
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-agent:
      group: docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=agent
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    build-docker-cli:
      group: docker
      image: anbraten/kaniko:v1.6.0-debug
      secrets: [docker_username, docker_password]
      environment:
        - IMAGE_TYPE=cli
      commands:
        - export WOODPECKER_VERSION=$(make version)
        - .woodpecker/scripts/build-docker-image.sh
      when:
        event: [push, tag]
        branch: master

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 35d09dc6b4b36e4327160096893b6ef9bc5cf7a077bdcf44485dadba29263772
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      commands:
        - go test -race -cover ./...

    vet:
      image: golang:1.16
      commands:
        - go vet ./...

    build:
      image: golang:1.16
      commands:
        - go build


config_hash: 884c00051d4d0a7b95e1ba1defe6c4692d5ce823db8c19801c869e85fd552088
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    changelog:
      image: alpine:3.14.1
      commands:
        - apk add make
        - curl -L https://dl.gitea.io/changelog-tool/master/changelog-master-linux-amd64 > changelog
        - chmod +x ./changelog
        - ./changelog -m=$(make version) generate > CHANGELOG-latest.md
        - ./changelog -m=$(make version) contributors >> CHANGELOG-latest.md
        - echo -e "$(cat CHANGELOG-latest.md)\n$(cat CHANGELOG.md)" > CHANGELOG.md
        # TODO push updated CHANGELOG.md with woodpecker-bot

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      note: CHANGELOG-latest.md
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: b8ddc0a0a1ee0b39525ccfdb09631b5b839da791040a3e9fc6c0d3277eb34dbe
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      commands:
        - make test

    vet:
      image: golang:1.16
      commands:
        - make vet

    build:
      image: golang:1.16
      commands:
        - go build


config_hash: d3818ca0211202dc590b5ce4eac82fb978670ef0d8024bce3e51f7414f1fab07
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    lint:
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      image: golang:1.16
      commands:
        - make test

    build:
      image: golang:1.16
      commands:
        - make build


config_hash: 5e890c8cd3a46b485e3c654e43089e6e409c4dedf16f0fe370b66f23395257af
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    lint:
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      image: golang:1.16
      commands:
        - make test

    build:
      image: golang:1.16
      commands:
        - make build

    dryrun:
      image: plugins/docker:linux-amd64
      settings:
        dockerfile: docker/Dockerfile.linux.amd64
        dry_run: true
        repo: woodpeckerci/plugin-s3
        tags: linux-amd64
      when:
        event: pull_request

    publish:
      image: plugins/docker:linux-amd64
      settings:
        dockerfile: docker/Dockerfile.linux.amd64
        repo: woodpeckerci/plugin-s3
        tags: linux-amd64
        password:
          from_secret: docker_password
        username:
          from_secret: docker_username
      when:
        branch: master
        event: push


config_hash: 61dbdf822a45e3fc776b3ae20f160c97412a271e5e935ff1049feddc76f38a53
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    lint:
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      image: golang:1.16
      commands:
        - make test

    build:
      image: golang:1.16
      commands:
        - make build

    dryrun:
      image: plugins/docker
      settings:
        dockerfile: docker/Dockerfile.linux.amd64
        dry_run: true
        repo: woodpeckerci/plugin-s3
        tags: latest
      when:
        event: pull_request

    publish:
      image: plugins/docker
      settings:
        dockerfile: docker/Dockerfile.linux.amd64
        repo: woodpeckerci/plugin-s3
        tags: latest
        password:
          from_secret: docker_password
        username:
          from_secret: docker_username
      when:
        branch: master
        event: push


config_hash: 01a536d55e95692ce1ae323bfadcad885334cecfd207c33e123b0ee9a0128801
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    lint:
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      image: golang:1.16
      commands:
        - make test

    build:
      image: golang:1.16
      commands:
        - make build

    dryrun:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      dry_run: true
      repo: woodpeckerci/plugin-s3
      tags: latest
      when:
        event: pull_request

    publish:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      repo: woodpeckerci/plugin-s3
      tags: latest
      secrets: [ docker_username, docker_password ]
      when:
        branch: master
        event: push


config_hash: fc79675c506bc16d89c386b1013886e1f44d0b6dcda13609beae759bb41ddbaa
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    lint:
      group: test
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      group: test
      image: golang:1.16
      commands:
        - make test

    build:
      image: golang:1.16
      commands:
        - make build

    dryrun:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      dry_run: true
      repo: woodpeckerci/plugin-s3
      tags: latest
      when:
        event: pull_request

    publish-next:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      repo: woodpeckerci/plugin-s3
      tags: next
      secrets: [docker_username, docker_password]
      when:
        branch: master
        event: push

    publish-tag:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      repo: woodpeckerci/plugin-s3
      tags: [latest, "${DRONE_TAG}"]
      secrets: [docker_username, docker_password]
      when:
        event: tag


config_hash: c8719afedd523028d65dd915f83e377e2e5d668c9fa7a60d5b105805c0c9a24f
config_name: woodpecker
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    lint:
      group: test
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      group: test
      image: golang:1.16
      commands:
        - make test

    build:
      image: golang:1.16
      commands:
        - make build

    dryrun:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      dry_run: true
      repo: woodpeckerci/plugin-git
      tags: latest
      when:
        event: pull_request

    publish-next:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      repo: woodpeckerci/plugin-git
      tags: next
      secrets: [docker_username, docker_password]
      when:
        branch: master
        event: push

    publish-tag:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      repo: woodpeckerci/plugin-git
      tags: [latest, "${DRONE_TAG}"]
      secrets: [docker_username, docker_password]
      when:
        event: tag


config_hash: b6da0a765e1cd04788a304f942d654b4d915f63212498a5390cabf1563591a6d
config_name: woodpecker
config_data:
  clone:
    git:
      image: woodpeckerci/plugin-git:next

  pipeline:
    lint:
      group: test
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      group: test
      image: golang:1.16
      commands:
        - make test

    build:
      image: golang:1.16
      commands:
        - make build

    dryrun:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      dry_run: true
      repo: woodpeckerci/plugin-git
      tags: latest
      when:
        event: pull_request

    publish-next:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      repo: woodpeckerci/plugin-git
      tags: next
      secrets: [docker_username, docker_password]
      when:
        branch: master
        event: push

    publish-tag:
      image: plugins/docker
      dockerfile: docker/Dockerfile.linux.amd64
      repo: woodpeckerci/plugin-git
      tags: [latest, "${DRONE_TAG}"]
      secrets: [docker_username, docker_password]
      when:
        event: tag


config_hash: 4f7ad772674313ee276c284684d8fd0de4ba857050ece4bb13797f7c1c6cddc7
config_name: woodpecker/docs
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    build:
      image: node:14-alpine
      commands:
        - cd docs/
        - yarn install --frozen-lockfile
        - yarn build
      when:
        event: [push, pull_request]
        path: "docs/**"

    deploy:
      image: alpine:3.14.2
      secrets:
        - BOT_PRIVATE_KEY
      commands:
        - apk add openssh-client git rsync
        - mkdir -p $HOME/.ssh
        - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
        - echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
        - chmod 0600 $HOME/.ssh/id_rsa
        - git config --global user.email "woodpecker-bot@obermui.de"
        - git config --global user.name "woodpecker-bot"
        - git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
        # copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
        - rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --delete docs/build/ /repo
        - cd /repo
        - git add .
        # exit successfully if nothing changed
        - test -n "$(git status --porcelain)" || exit 0
        - git commit -m "Deploy website - based on ${CI_COMMIT_SHA}"
        - git push
      when:
        event: push
        branch: master
        path: "docs/**"


config_hash: d4874b01b5ebc8401c1bc1dbbe4c266fb28c68d2ebda398d0ee70f777fd4cbc0
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION="${CI_TAG##v}"
        - export CHART_VERSION=$${CHART_VERSION:=0.0.0}
        - echo "Version $CHART_VERSION"
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"


config_hash: 4884c71ea7bf817eafd5e4db0e96bd4c427f76cf7edbacb8f4bef6c313cebaeb
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${CI_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: e1ddb48a023e739d007ebfb637939831887f18e3766d8ab37a8df3907e97c148
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION="${CI_COMMIT_TAG##v}"
        - export CHART_VERSION=$${CHART_VERSION:=0.0.0}
        - echo "Version $CHART_VERSION"
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.github.io --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"


config_hash: 2fea77b6b5051ac8b95f5740751a46197c84d1d1b5668adeece4d34c9495a4d2
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${CI_COMMIT_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 36dd00766c00c27529c58410594833f2c20e5d4059c464d73b3cfec399943c18
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: c038d49489b2d80ee5fbf74c6f03586ae920edee2c6f7936c333c1cb5145a1d9
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-adk-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.apk
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 0a14c21c99fb0076e4dff9d6753b5a235b1a4e73aa20280580e04594328458a5
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: e87f30bd055696ca3a250bb46c158ed00c677b1adb0325345d3a200dd684b68f
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: f1e596f89fca74784b9b37efdc41e6bf82568338b7a64b14cc31401f6488bbae
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 6cc2e1dafef22d6971c47c5faa0c33a43b9a5c5bda9b4b29a313395f29e1f91a
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION="${DRONE_TAG##v}"
        - export CHART_VERSION=$${CHART_VERSION:=0.0.0}
        - echo "Version $CHART_VERSION"
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.org --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"


config_hash: 7768fba05b24d98252c502c54836ee4304d052a3dd7bcf182f19041c2128ddff
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    publish-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: 9a70e5a5a03bf51178a5101ecb3ad31abb859d53dab3b017170586b5bd32be25
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes

  depends_on:
    - web


config_hash: fee4e72392315c8bdd5ed0dcd6cc361b656f136d6e0e727a4515b539e2c1e7a6
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore_meddler

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore_meddler

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 656753d96e1f9d7e59a7c652083b4a2e206c5b45f3ddeb6d94528a19df10ddf6
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    test:
      image: golang:1.16
      group: test
      commands:
        - make test

    test-frontend:
      image: node:10.17.0-stretch
      group: test
      commands:
        - (cd web/; yarn install --frozen-lockfile)
        - (cd web/; yarn run lesshint)
        - (cd web/; yarn run lint --quiet)
        - make test-frontend

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=postgres
        - DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - DATABASE_DRIVER=mysql
        - DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/store/datastore

    build-frontend:
      image: node:10.17.0-stretch
      commands:
        - make build-frontend

    build:
      image: golang:1.16
      commands:
        - make release

    build-cli:
      image: golang:1.16
      commands: make release-cli

    publish-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: [v0.14]
      when:
        branch: release/v0.14
        event: push

    publish-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [v0.14]
      when:
        branch: release/v0.14
        event: push

    release-server:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-agent:
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: ${DRONE_TAG}
      when:
        event: tag

    release-cli:
      image: plugins/github-release
      files:
        - cli/release/woodpecker_*.tar.gz
        - cli/release/woodpecker_checksums.txt
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 9f0b287d7b73d89dc4a9665b9dc1e85c7085d3dd8570788f948a9b70f3de731e
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

    web-lint:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn lint
      when:
        path: "web/**"

    web-formatcheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: c3944d086b250f1e38a81bf2fd73ec709ea68c9f58401147c75acd82bed82543
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

    web-lint:
      # TODO: disabled group for now to prevent oom
      # group: web-test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn lint
      when:
        path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:14-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:14-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:14-alpine
      commands:
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: cb7611a93715d56acb14caceb6478af2f0ea75f94a393802cf5111545c10471b
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

    web-lint:
      # TODO: disabled group for now to prevent oom
      # group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn lint
      when:
        path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 9978aa99084dddf7c1aa76d8f7f5aaa6b51ac13562b9cfced2e64e240144e7d0
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 48051e3480dc20a23bde84598506eac6a3701b23dfdf68f3a9cd3705b58fd906
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore_meddler

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore_meddler

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: ff733d9d6538809b31d1190bc4c2199dc5a50f1331e0e369b54ab0320d7d91d5
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore_xorm

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore_xorm

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: f5a8b930f73f21bc6718a2e4b1b3d44caa0ef85098459da78b53f8b204404bed
config_name: woodpecker/helm
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    set-version:
      image: alpine/helm:3.5.3
      commands:
        # use tag name or 0.0.0 if not running on a tag
        - export CHART_VERSION="${CI_COMMIT_TAG##v}"
        - export CHART_VERSION=$${CHART_VERSION:=0.0.0}
        - echo "Version $CHART_VERSION"
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-agent/Chart.yaml
        - sed -i "s/<version>/$CHART_VERSION/g" charts/woodpecker-server/Chart.yaml
        - cat charts/woodpecker-agent/Chart.yaml
        - cat charts/woodpecker-server/Chart.yaml
      when:
        path: "charts/**"

    lint:
      image: alpine/helm:3.5.3
      commands:
        - helm lint charts/woodpecker-agent/
        - helm lint charts/woodpecker-server/
      when:
        path: "charts/**"

    release:
      image: quay.io/helmpack/chart-releaser:v1.2.1
      secrets:
        - source: github_token
          target: CR_TOKEN
      commands:
        - mkdir -p .cr-index
        - cr package charts/woodpecker-server
        - cr package charts/woodpecker-agent
        - cr upload --owner woodpecker-ci --git-repo woodpecker-ci.github.io --release-name-template "helm-{{ .Name }}-{{ .Version }}"
        - cr index --owner woodpecker-ci --git-repo woodpecker-ci.github.io --pages-branch main --charts-repo https://woodpecker-ci.org --push --release-name-template "helm-{{ .Name }}-{{ .Version }}"
      when:
        event: tag
        path: "charts/**"


config_hash: 27ae38cfddf13877e35d26b3ac110070a30fcdeff596eefa4be2b12a33d1607d
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${CI_COMMIT_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 3421e34a1be6aeee4e3f1b6741d4a178ed5340700403f5117d3fe32e188d48bf
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make lint

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 59fa65e9b406c908860579a7248071dd57d36fd531e5f14532221e2bacd2f2a0
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 963b69c7279409c95c18deec4d90991947abb0795e7a865e5e2b7e77903213e5
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make vet
        - make lint
        - make formatcheck

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${DRONE_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${DRONE_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${DRONE_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 6525101ed9f35539b4b9ce533f12619059160f9fa184a2e8041dfbba4e9fe934
config_name: woodpecker/main
config_data:
  clone:
    git:
      image: plugins/git:next

  pipeline:
    web-deps:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn install --frozen-lockfile
      when:
        path: "web/**"

  #  TODO: enable if we have enouth mem (~2g) to lint, cause an oom atm.
  #        For reviewers, please run localy to verify it passes
  #  web-lint:
  #    TODO: disabled group for now to prevent oom
  #    group: web-test
  #    image: node:16-alpine
  #    commands:
  #      - cd web/
  #      - yarn lint
  #    when:
  #      path: "web/**"

    web-formatcheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn formatcheck
      when:
        path: "web/**"

    web-typecheck:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn typecheck
      when:
        path: "web/**"

    web-test:
      group: web-test
      image: node:16-alpine
      commands:
        - cd web/
        - yarn test
      when:
        path: "web/**"

    web-build:
      image: node:16-alpine
      commands:
        - cd web/
        - yarn build
      when:
        path: "web/**"

    test:
      image: golang:1.16
      group: test
      commands:
        - make test
        - make lint

    test-postgres:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=postgres
        - WOODPECKER_DATABASE_CONFIG=host=postgres user=postgres dbname=postgres sslmode=disable
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    test-mysql:
      image: golang:1.16
      group: db-test
      environment:
        - WOODPECKER_DATABASE_DRIVER=mysql
        - WOODPECKER_DATABASE_CONFIG=root@tcp(mysql:3306)/test?parseTime=true
      commands:
        - go test -timeout 30s github.com/woodpecker-ci/woodpecker/server/store/datastore

    build-frontend:
      image: node:16-alpine
      commands:
        - apk add make
        - make release-frontend

    build-server:
      group: build
      image: golang:1.16
      commands:
        - make release-server

    build-agent:
      group: build
      image: golang:1.16
      commands:
        - make release-agent

    build-cli:
      group: build
      image: golang:1.16
      commands:
        - make release-cli

    build-deb-rpm:
      group: bundle
      image: golang:1.16
      commands:
        - make bundle
      when:
        event: [push, tag]
        branch: master

    publish-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      # TODO: only release as next after 0.15.0 got released
      tag: [next, latest]
      when:
        branch: master
        event: push

    publish-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      # TODO: only release as next-alpine after 0.15.0 got released
      tag: [next-alpine, latest-alpine]
      when:
        branch: master
        event: push

    publish-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [next]
      when:
        branch: master
        event: push

    publish-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [next-alpine]
      when:
        branch: master
        event: push

    release-server:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-server-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-server
      dockerfile: docker/Dockerfile.server.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    release-agent:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-agent-alpine:
      group: bundle
      image: plugins/docker
      repo: woodpeckerci/woodpecker-agent
      dockerfile: docker/Dockerfile.agent.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    release-cli:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli
      secrets: [docker_username, docker_password]
      tag: [latest, "${CI_COMMIT_TAG}"]
      when:
        event: tag

    release-cli-alpine:
      group: docker
      image: plugins/docker
      repo: woodpeckerci/woodpecker-cli
      dockerfile: docker/Dockerfile.cli.alpine
      secrets: [ docker_username, docker_password ]
      tag: [latest-alpine, "${CI_COMMIT_TAG}-alpine"]
      when:
        event: tag

    checksums:
      image: golang:1.16
      commands:
        - make release-checksums
      when:
        event: tag

    # TODO: upload build artifacts for pushes to master

    release:
      image: plugins/github-release
      files:
        - dist/*.tar.gz
        - dist/*.deb
        - dist/*.rpm
        - dist/checksums.txt
      title: ${CI_COMMIT_TAG##v}
      secrets:
        - source: github_token
          target: github_release_api_key
      when:
        event: tag

  services:
    postgres:
      image: postgres:9.6
      ports: ["5432"]
      environment:
        - POSTGRES_USER=postgres
        - POSTGRES_HOST_AUTH_METHOD=trust
    mysql:
      image: mysql:5.6.27
      ports: ["3306"]
      environment:
        - MYSQL_DATABASE=test
        - MYSQL_ALLOW_EMPTY_PASSWORD=yes


config_hash: 6025f4af3cae84be4986f3e924d72c16e6643c7b3783fb28b2b700006d998d6b
config_name: woodpecker
config_data:
  clone:
    git:
      image: woodpeckerci/plugin-git:next

  pipeline:
    lint:
      group: test
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      group: test
      image: golang:1.16
      commands:
        - make test

    dryrun:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      dry_run: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
      tags: latest
      secrets: [docker_username, docker_password]
      when:
        event: pull_request

    build-next:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
      tags: next
      secrets: [docker_username, docker_password]
      when:
        branch: master
        event: push

    build-tag:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
      tags: [latest, "${DRONE_TAG}"]
      secrets: [docker_username, docker_password]
      when:
        event: tag


config_hash: f6fc95307c1cdb8f162ccc215e325da79b243e246f2debc501509c93271f9e0e
config_name: woodpecker
config_data:
  clone:
    git:
      image: woodpeckerci/plugin-git:next

  pipeline:
    lint:
      group: test
      image: golang:1.16
      commands:
        - make vet
        - make formatcheck

    test:
      group: test
      image: golang:1.16
      commands:
        - make test

    dryrun:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      dry_run: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
      tags: latest
      secrets: [docker_username, docker_password]
      when:
        event: pull_request

    build-next:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
      tags: next
      secrets: [docker_username, docker_password]
      when:
        branch: master
        event: push

    build-tag:
      image: thegeeklab/drone-docker-buildx:latest
      dockerfile: ./docker/Dockerfile.multiarch
      privileged: true
      repo: woodpeckerci/plugin-git
      platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
      tags: [latest, "${DRONE_TAG}"]
      secrets: [docker_username, docker_password]
      when:
        event: tag


