diff --git a/.github/workflows/backend.yaml b/.github/workflows/backend.yaml new file mode 100644 index 0000000..596808b --- /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 d7441be..0000000 --- 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