kind: pipeline
type: docker
name: build

steps:
- name: build
  image: timbru31/node-alpine-git:18
  commands:
  - yarn
  # - yarn build
- name: push-image

  image: plugins/docker:latest
  settings:
    registry: gitea.bsidesolutions.net
    repo: gitea.bsidesolutions.net/oonyeje/oonyeje-portfolio
    username:
      from_secret: DOCKER_USERNAME
    password:
      from_secret: DOCKER_PASSWORD
    # email:
    #   from_secret: DOCKER_EMAIL
    tags:
    - latest
    dockerfile: ./Dockerfile
    context: ./

# - name: deploy-staging
#   image: plugins/ansible:latest
#   settings:
#     playbook: ansible/playbook.staging.yml
#     galaxy: ansible/requirements.yml
#     inventory: ansible/inventory.yml
#     become_user: bside
#     user: bside
#     verbose: 4
#     become: true
#     list_tasks: true
#     list_hosts: true
#     private_key:
#       from_secret: STAGING_SERVER_PRIVATE_KEY
# trigger:
#   branch:
#   - master
#   - prod
#   - qa
#   - feature/*
#   event:
#   - push
#   - pull_request
---
kind: pipeline
type: exec
name: staging-deploy

platform:
  os: linux
  arch: amd64

steps:
- name: ansible-deploy
  commands:
  - ansible --version
  - ansible-galaxy install --force --role-file ansible/requirements.yml -vvvv
  - ansible-playbook --inventory ansible/inventory.yml --list-hosts ansible/playbook.staging.yml
# trigger:
#   branch:
#   - master
#   - prod
#   - qa
#   - feature/*
#   event:
#   - push
#   - pull_request
