name: Attu prod release

on:
  release:
    types: [released]
    branches: [main]

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14

      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PWD }}

      - name: Docker Build
        run: docker build -t zilliz/attu:${GITHUB_REF#refs/tags/} --build-arg VERSION=${GITHUB_REF#refs/tags/} .

      - name: Docker tag
        run: docker tag zilliz/attu:${GITHUB_REF#refs/tags/} zilliz/attu:latest

      - name: Docker Push lastest
        run: docker push zilliz/attu
