name: publish dev image docker
on:
  push:
    branches:
      - '*'
      - '*/*'
      - '!master'
jobs:
  build:
    if: github.repository_owner == 'TandoorRecipes'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      # Update Version number
      - name: Update version file
        uses: DamianReeves/write-file-action@v1.0
        with:
          path: recipes/version.py
          contents: |
            VERSION_NUMBER = 'develop'
            BUILD_REF = '${{ github.sha }}'
          write-mode: overwrite
      # Build Vue frontend
      - uses: actions/setup-node@v2
        with:
          node-version: '14'
      - name: Clear Cache
        working-directory: ./vue
        run: yarn cache clean --all
      - name: Install dependencies
        working-directory: ./vue
        run: yarn install
      - name: Build dependencies
        working-directory: ./vue
        run: yarn build
      # Build container
      - name: Publish to Registry
        uses: elgohr/Publish-Docker-Github-Action@2.13
        with:
          name: vabene1111/recipes
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
