reverted some chganges in package.json #18
This file contains 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
# This workflow installs Node.js dependencies, caches them, builds the source code, runs tests, performs a Snyk security check, and builds/pushes a Docker image. | |
name: Node.js CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# Step 2: Set up Node.js environment (latest version) | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
cache: npm | |
# Step 3: Install dependencies | |
- name: Install Dependencies | |
run: npm ci | |
# Step 4: Build the source code (if applicable) | |
- name: Build Source Code | |
run: npm run build --if-present | |
# Step 5: Run tests | |
- name: Run Tests | |
run: npm test --if-present | |
snyk: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# Step 2: Set up Node.js environment (latest version) | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
cache: npm | |
# Step 3: Install Snyk | |
- name: Install Snyk | |
run: npm install -g snyk | |
# Step 4: Authenticate Snyk | |
- name: Authenticate Snyk | |
run: snyk auth ${{ secrets.SNYK_TOKEN }} | |
# Step 5: Run Snyk security scan | |
- name: Snyk Security Scan | |
run: snyk test --all-projects --continue-on-error | |
docker: | |
needs: snyk | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# Step 2: Log in to Docker Hub | |
- name: Log in to Docker Hub | |
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin | |
# Step 3: Build Docker image | |
- name: Build Docker Image | |
run: docker build -t gregory789/contint-repository:contint-backend . | |
# Step 4: Push Docker image to Docker Hub | |
- name: Push Docker Image | |
run: docker push gregory789/contint-repository:contint-backend |