diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 643028cf5..1a93e02b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - main - develop jobs: - build: + build_and_test: runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -32,3 +32,39 @@ jobs: - name: Test run: dotnet test --no-restore --verbosity normal + build_and_push: + name: Build & Publish to Docker Hub + needs: build_and_test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2.1.4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Extract Git Tag + run: echo ::set-env name=GIT_TAG::${GITHUB_REF/refs\/tags\//:1} + - name: Build and push base + uses: docker/build-push-action@v2 + with: + context: . + file: ./docker/Dockerfile + push: true + build-args: | + INFO_VERSION=${{ env.GIT_TAG }}-docker + tags: | + jasongdove/ersatztv:develop +# jasongdove/ersatztv:${{ env.GIT_TAG }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache,mode=max