updated:server port #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Checkout code | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| # Step 2: Set up Node.js | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| # Step 3: Install pnpm | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| # Step 4: Install dependencies | |
| - name: Install dependencies | |
| run: pnpm install | |
| # Step 5: Run tests (optional, skip if none) | |
| - name: Run tests | |
| run: pnpm test || echo "No tests configured yet" | |
| # Step 6: Build TypeScript | |
| - name: Build TypeScript | |
| run: pnpm exec tsc | |
| # Step 7: Log in to Docker Hub | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| # Step 8: Build Docker image | |
| - name: Build Docker image | |
| run: docker build -t raone1422g/restapi:v1.0 . | |
| # Step 9: Push Docker image | |
| - name: Push Docker image | |
| run: docker push raone1422g/restapi:v1.0 |