Skip to content

Semantic version tests #36

Semantic version tests

Semantic version tests #36

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Git Semantic Version
uses: PaulHatch/semantic-version@v5.4.0
with:
major_pattern: "major:"
minor_pattern: "feat:"
version_format: "${major}.${minor}.${patch}-prerelease${increment}"
id: version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Docker auth
uses: docker/login-action@v1
with:
username: ${{ env.DOCKER_USER }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Print Version
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
run: |
echo "New version: $NEW_VERSION !!!!!!!!!!!!!!!!"
# - name: Build and push Docker Image
# uses: docker/build-push-action@v2
# with:
# context: ./
# push: true
# dockerfile: ./Dockerfile
# tags: jaderodev/aup-backend:latest
# deploy:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Docker auth
# uses: docker/login-action@v1
# with:
# username: ${{ env.DOCKER_USER }}
# password: ${{ env.DOCKER_PASSWORD }}
# - name: Set permissions for private key
# run: |
# echo "${{ secrets.AWS_PRIVATE_KEY }}" > key.pem
# chmod 600 key.pem
# - name: Move to project folder
# run: |
# ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@3.228.164.55 'cd backend/ && sudo docker compose down'
# - name: Remove old image
# run: |
# ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@3.228.164.55 'sudo docker image rm -f backend-aup-backend:latest'
# - name: Run new containers
# run: |
# ssh -o StrictHostKeyChecking=no -i key.pem ubuntu@3.228.164.55 'cd backend/ && git pull && sudo docker compose up -d'