Merge pull request #5 from Killpit/master #1
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
name: Cart | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '**.js' # Only trigger on changes to Python files (**.py) | |
- '.github/workflows/cart.yaml' # Include workflow file changes | |
pull_request: | |
branches: | |
- master | |
paths: | |
- '**.js' # Only trigger on changes to Python files (**.py) | |
- '.github/workflows/cart.yaml' # Include workflow file changes | |
jobs: | |
payment: | |
name: Build and deploy cart microservice | |
runs-on: [self-hosted] # Use a standard runner instead of self-hosted | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: NPM install | |
run: npm install | |
- name: Build Docker image | |
run: | | |
docker build -t cart . # Build image tagged as 'payment' from current directory | |
- name: Docker Login (use secrets) | |
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Push | |
run: | | |
docker tag cart ${name}/cart:latest | |
docker push ${name}/cart:latest |