From 87071f8a8ef3555cd4b60dbd7fdde4b42347bccd Mon Sep 17 00:00:00 2001 From: Krystof Date: Sun, 21 Apr 2024 23:57:02 +0200 Subject: [PATCH] chore(gh-actions): backend --- .github/workflows/backend.yaml | 54 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 28 ------------------ 2 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/backend.yaml delete mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/backend.yaml b/.github/workflows/backend.yaml new file mode 100644 index 00000000..dfb04ba8 --- /dev/null +++ b/.github/workflows/backend.yaml @@ -0,0 +1,54 @@ +name: Backend +on: + push: + paths: + - "backend/**" + paths-ignore: + - "**/*.md" + - "**/*.mdx" + - "**/**.example.*" + +jobs: + ci: + name: CI + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v1 + + - run: | + cd ./backend + bun install + bun run build + + publish-docker-image: + needs: ci + runs-on: ubuntu-latest + # if: github.ref == 'refs/heads/main' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and publish + uses: docker/build-push-action@v5 + with: + context: ./backend + push: true + tags: krystxf/metro-now-backend:latest diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index d7441beb..00000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: CI -on: push - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v1 - - - run: | - cd ./backend - bun install - bun run build - - build-docker: - name: Build Docker Image - runs-on: ubuntu-latest - needs: build - steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v1 - - - run: | - cd ./backend - bun install - bun run docker:build