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: Payment | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '**.py' # Only trigger on changes to Python files (**.py) | |
- '.github/workflows/payment.yaml' # Include workflow file changes | |
pull_request: | |
branches: | |
- master | |
paths: | |
- '**.py' # Only trigger on changes to Python files (**.py) | |
- '.github/workflows/payment.yaml' # Include workflow file changes | |
jobs: | |
payment: | |
name: Build and deploy payment 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: Python install | |
run: sudo apt-get install python3 | |
- name: Build Docker image | |
run: | | |
docker build -t payment . # 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 payment ${name}/payment:latest | |
docker push ${name}/payment:latest |