From f69faddcd5c5f3c5f8ea83b82bb2040a373364bf Mon Sep 17 00:00:00 2001 From: nzambello Date: Tue, 18 Jul 2023 19:08:26 +0200 Subject: [PATCH] ci: add gh workflow --- .github/workflows/publish.yml | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..3851c07 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,57 @@ +name: Docker CI + +on: + push: + branches: + - main + workflow_dispatch: + +env: + node-version: 18.x + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + nzambello/nzambello.dev + labels: | + org.label-schema.docker.cmd=docker run -d -p 8080:8080 nzambello/nzambello.dev:latest + flavor: latest=false + tags: | + type=ref,event=branch + type=sha + type=raw,value=latest,enable={{is_default_branch}} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Container Registry + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + context: frontend/ + file: frontend/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: $${{ steps.meta.outputs.labels }}