From ecb0253257b00bee9e86622b9c104db57fc05997 Mon Sep 17 00:00:00 2001 From: guusvanmeerveld Date: Thu, 30 Sep 2021 16:34:39 +0200 Subject: [PATCH] Github actions now builds for Docker hub --- .github/workflows/build.yml | 43 ++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1bdcd3d..d85f106 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,18 +6,59 @@ on: - master jobs: - typescript: + test: runs-on: ubuntu-latest steps: - name: Setup checkout uses: actions/checkout@v2 + - name: Setup NodeJS v12 uses: actions/setup-node@v1 with: node-version: 12 + - name: Install Dependencies run: yarn install + - name: Check for syntax errors run: yarn test-build + - name: ESlint check run: yarn lint + + docker: + needs: test + runs-on: ubuntu-latest + steps: + - name: Setup checkout + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Build and push + uses: docker/build-push-action@v2 + with: + push: true + tags: guusvanmeerveld/portfolio:latest + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache + builder: ${{ steps.buildx.outputs.name }} + + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} +