chore(deps): bump docker/build-push-action from 6 to 7 #867
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, pull_request, workflow_dispatch] | |
| permissions: | |
| contents: read | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| eslint: | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run ESLint | |
| run: npm run lint | |
| prettier: | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run Prettier | |
| run: npm run format | |
| commit: | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Check commit messages | |
| run: npx commitlint --from=HEAD~1 --to=HEAD | |
| testing: | |
| runs-on: ubuntu-latest | |
| needs: [setup, eslint, prettier, commit] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run Unit Tests | |
| run: npm run test:unit | |
| - name: Generate coverage report | |
| run: npm run test:coverage | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [testing] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install server dependencies | |
| run: npm install | |
| - name: Install frontend dependencies | |
| run: cd public && npm install | |
| - name: Build frontend | |
| run: npm run build | |
| - name: Copy swagger docs | |
| run: | | |
| mkdir -p dist/src/docs | |
| cp -r src/docs/* dist/src/docs/ || echo "No docs to copy" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: server-build | |
| path: | | |
| dist/ | |
| public/dist/ | |
| src/docs/ | |
| package.json | |
| vercel.json | |
| CHANGELOG.md | |
| deployment: | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: server-build | |
| path: . | |
| - name: Install Vercel CLI | |
| run: npm install --global vercel@latest | |
| - name: Deploy to Vercel | |
| run: | | |
| vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| # Skip the build step since we've already built | |
| vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| # Only run on main branch pushes, not on PRs | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Get current version from CHANGELOG | |
| id: get_version | |
| run: | | |
| # Extract the first version from CHANGELOG.md | |
| VERSION=$(grep -m 1 -oP '(?<=## \[)[0-9.]+(?=\])' CHANGELOG.md) | |
| echo "Found version: ${VERSION}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ env.DOCKERHUB_USERNAME }} | |
| password: ${{ env.DOCKERHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| target: production | |
| push: true | |
| tags: | | |
| ${{ env.DOCKERHUB_USERNAME }}/tasktrial:${{ steps.get_version.outputs.version }} |