add tldr week 0 #7
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 Pipeline | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: week-0-baseline/todo-api | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run linter | |
| run: npm run lint | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| defaults: | |
| run: | |
| working-directory: week-0-baseline/todo-api | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/todo-api:main-${{ github.sha }} . | |
| push: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| defaults: | |
| run: | |
| working-directory: week-0-baseline/todo-api | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| run: | | |
| docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/todo-api:main-${{ github.sha }} . | |
| docker push ${{ secrets.DOCKERHUB_USERNAME }}/todo-api:main-${{ github.sha }} |