Skip to content

Merge pull request #159 from devopshobbies/terrform/argocd #13

Merge pull request #159 from devopshobbies/terrform/argocd

Merge pull request #159 from devopshobbies/terrform/argocd #13

Workflow file for this run

name: Realse Version
on:
push:
branches:
- master
- dev
paths:
- 'app/**'
- 'crawl/**'
jobs:
releaseGithub:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- name: Bump version and push tag
id: bump
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fromTag: ${{ steps.bump.outputs.previous_tag }}
toTag: ${{ steps.bump.outputs.new_tag }}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.bump.outputs.changelog }}
tag_name: ${{ steps.bump.outputs.new_tag }}
releaseDockerWithDeployment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/devopsgpt-fastapi:${{ github.ref_name }}
- name: Deploying landing prod on the remote server
if: github.ref == 'refs/heads/master'
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.HOST_USERNAME }}
password: ${{ secrets.HOST_PASSWORD }}
port: ${{ secrets.HOST_PORT }}
script: docker compose -f devopsgpt-fastapi/docker-compose-fastapi.yml down fastapi_prod && docker compose -f devopsgpt-fastapi/docker-compose-fastapi.yml up -d --pull always fastapi_prod
- name: Deploying landing dev on the remote server
if: github.ref == 'refs/heads/dev'
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.HOST_USERNAME }}
password: ${{ secrets.HOST_PASSWORD }}
port: ${{ secrets.HOST_PORT }}
script: docker compose -f devopsgpt-fastapi/docker-compose-fastapi.yml down fastapi_dev && docker compose -f devopsgpt-fastapi/docker-compose-fastapi.yml up -d --pull always fastapi_dev
- name: Removing dangle images on the remote server
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.HOST_USERNAME }}
password: ${{ secrets.HOST_PASSWORD }}
port: ${{ secrets.HOST_PORT }}
script: docker image prune -f