name: Build & Deploy Managing API on: push: branches: [ "dev" ] pull_request: branches: [ "dev" ] jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Preset Image Name run: echo "IMAGE_URL=$(echo ghcr.io/${{ github.repository_owner }}/managing-api:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - name: Build and push Docker Image uses: docker/build-push-action@v5 with: context: . file: ./src/Dockerfile-managing-api-dev push: true tags: | ${{ env.IMAGE_URL }} ghcr.io/${{ github.repository_owner }}/managing-api:latest - name: Deploy Image to CapRover uses: caprover/deploy-from-github@v1.1.2 with: server: "${{ secrets.CAPROVER_SERVER }}" app: "${{ secrets.APP_NAME }}" token: "${{ secrets.APP_TOKEN }}" image: ${{ env.IMAGE_URL }}