chore(deps): bump actions/download-artifact from 4 to 5 #41
Workflow file for this run
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, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| NODE_VERSION: '18' | |
| DOTNET_VERSION: '9.0.x' | |
| jobs: | |
| version-check: | |
| name: Version Consistency Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: client-ts/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./client-ts | |
| run: npm ci | |
| - name: Check version consistency | |
| working-directory: ./client-ts | |
| run: npm run version:check | |
| continue-on-error: false | |
| frontend-tests: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| needs: version-check | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: client-ts/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./client-ts | |
| run: npm ci | |
| - name: Run linting | |
| working-directory: ./client-ts | |
| run: npm run lint | |
| - name: Run type checking | |
| working-directory: ./client-ts | |
| run: npm run type-check | |
| - name: Run tests | |
| working-directory: ./client-ts | |
| run: npm run test:ci | |
| backend-tests: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| needs: version-check | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: testpassword | |
| MYSQL_DATABASE: TaskManagerDbTest | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build project | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Run tests | |
| run: dotnet test --configuration Release --no-build --verbosity normal | |
| env: | |
| ConnectionStrings__DefaultConnection: "Server=localhost;Database=TaskManagerDbTest;Uid=root;Pwd=testpassword;" | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| needs: [version-check] | |
| permissions: | |
| contents: read | |
| security-events: write | |
| actions: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: 'trivy-results.sarif' | |
| - name: Run npm audit for frontend | |
| working-directory: ./client-ts | |
| run: npm audit --audit-level moderate || true | |
| - name: Run dotnet list package vulnerabilities | |
| run: dotnet list package --vulnerable || true | |
| build-application: | |
| name: Build Application | |
| runs-on: ubuntu-latest | |
| needs: [frontend-tests, backend-tests] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: client-ts/package-lock.json | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Install frontend dependencies | |
| working-directory: ./client-ts | |
| run: npm ci | |
| - name: Build frontend | |
| working-directory: ./client-ts | |
| run: npm run build | |
| - name: Restore backend dependencies | |
| run: dotnet restore | |
| - name: Build backend | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Publish backend | |
| run: dotnet publish --configuration Release --no-build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| ./client-ts/build/ | |
| ./publish/ | |
| retention-days: 7 | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [build-application, security-scan] | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: build-artifacts | |
| - name: Get version from package.json | |
| id: version | |
| working-directory: ./client-ts | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=v$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if tag exists | |
| id: check-tag | |
| run: | | |
| if git rev-parse "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Release | |
| if: steps.check-tag.outputs.exists == 'false' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| release_name: Release ${{ steps.version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| body: | | |
| ## 🚀 Release ${{ steps.version.outputs.version }} | |
| ### Changes | |
| - Automated release from CI/CD pipeline | |
| - All tests passed ✅ | |
| - Security scan completed ✅ | |
| - Application built successfully ✅ | |
| ### Build Artifacts | |
| - Frontend build ready for deployment | |
| - Backend publish ready for deployment | |
| ### Installation | |
| Download the artifacts from the Actions tab or use the built application directly. | |
| files: | | |
| build-artifacts/client-ts/build/* | |
| build-artifacts/publish/* |