Skip to content

Merge pull request #4 from Yannx79/develop #3

Merge pull request #4 from Yannx79/develop

Merge pull request #4 from Yannx79/develop #3

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Git Semantic Version
uses: PaulHatch/[email protected]
with:
major_pattern: "major:"
minor_pattern: "feat:"
format: "${major}.${minor}.${patch}-prerelease${increment}"
id: version
- name: Docker Login
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build Docker Image
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
run: |
docker build -f Dockerfile.prod -t $DOCKER_USER/$DOCKER_REPOSITORY:$NEW_VERSION .
docker tag $DOCKER_USER/$DOCKER_REPOSITORY:$NEW_VERSION $DOCKER_USER/$DOCKER_REPOSITORY:latest
- name: Push Docker Image
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
DOCKER_USER: ${{ secrets.DOCKER_USER }}
run: |
docker push $DOCKER_USER/$DOCKER_REPOSITORY:$NEW_VERSION
docker push $DOCKER_USER/$DOCKER_REPOSITORY:latest