name: Build and push Docker image on new release
on:
  workflow_dispatch:
jobs:
  buildDockerImage:
    runs-on: ubuntu-latest
    steps:
      -
        name: Get latest airdcpp release
        id: airdcpp-release
        run: |
          echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/airdcpp-web/airdcpp-webclient/releases/latest | jq -r ".tag_name")
          echo ::set-output name=current_tag::$(<airdcpp-release.version)
      -
        if: steps.airdcpp-release.outputs.current_tag != steps.airdcpp-release.outputs.release_tag
        name: Checkout
        uses: actions/checkout@v2
      -
        if: steps.airdcpp-release.outputs.current_tag != steps.airdcpp-release.outputs.release_tag
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        if: steps.airdcpp-release.outputs.current_tag != steps.airdcpp-release.outputs.release_tag
        name: Login to DockerHub
        uses: docker/login-action@v1 
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        if: steps.airdcpp-release.outputs.current_tag != steps.airdcpp-release.outputs.release_tag
        name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          context: .
          no-cache: true
          push: true
          tags: |
            gangefors/airdcpp-webclient:latest-test
            gangefors/airdcpp-webclient:${{ steps.airdcpp-release.outputs.release_tag }}-test
      -
        name: Update release versiopn
        if: steps.airdcpp-release.outputs.current_tag != steps.airdcpp-release.outputs.release_tag
        run: |
          # Update current release
          echo ${{ steps.airdcpp-release.outputs.release_tag }} > airdcpp-release.version

Add workflow for building docker image
Add workflow for building docker image

This workflow should build and push a new docker image whenever a new release is available in the upstream repo.

This is my first attempt at using github Actions so this will most likely not work on the first commit.

And since I can't test my workflows on other branches the main branch will be littered with my failed attempts.
