---
kind: pipeline
type: docker
name: Build and publish

platform:
  os: linux
  arch: amd64

steps:
  - name: lint
    image: node:21-alpine3.17
    commands:
      - yarn
      - yarn lint

  - name: build
    image: node:21-alpine3.17
    commands:
      - yarn
      - yarn build

  - name: Build and publish docker image
    image: plugins/docker
    settings:
      registry: ghcr.io
      repo: ghcr.io/kevinmidboe/k9e.no
      dockerfile: Dockerfile
      username:
        from_secret: GITHUB_USERNAME
      password:
        from_secret: GITHUB_PASSWORD
      tags: latest
    when:
      event:
        include:
          - push
        exclude:
          - pull_request
      branch:
        - main
