feat(terraform-templates): implementing aws-alb route #17
This file contains hidden or 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: 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/[email protected] | |
| 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/[email protected] | |
| 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/[email protected] | |
| 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/[email protected] | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.HOST_USERNAME }} | |
| password: ${{ secrets.HOST_PASSWORD }} | |
| port: ${{ secrets.HOST_PORT }} | |
| script: docker image prune -f |