Skip to content

fix 🐞: Fix Working Dir #6

fix 🐞: Fix Working Dir

fix 🐞: Fix Working Dir #6

Workflow file for this run

name: Node.js CI
on:
push:
branches: ['ci', 'dev']
tags: ['v*']
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: 1-order-service
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '24.x'
- run: npm ci
- run: npm run build --if-present
- run: cat Dockerfile
build-and-push:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || 'refs/heads/ci' || startsWith(github.ref, 'refs/tags/')
defaults:
run:
working-directory: 1-order-service
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set environment variables
run: |
echo "IMAGE_NAME=${{ secrets.DOCKER_USERNAME }}/${{ vars.IMAGE_NAME_1 }}" >> $GITHUB_ENV
echo "IMAGE_TAG=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "IMAGE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
fi
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.ref == 'refs/heads/main' ||'refs/heads/ci' || startsWith(github.ref, 'refs/tags/') }}
tags: |
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max