From 28a512baf005d183b9e9fb5c3c926da2cae718ff Mon Sep 17 00:00:00 2001 From: HotaruBlaze Date: Thu, 23 Sep 2021 03:28:26 +0000 Subject: [PATCH] Change Deployment to be cleaner --- .github/workflows/action-deploy.yml | 42 ---------------------- .github/workflows/actions.yml | 56 +++++++++++++++++++++++++++++ .github/workflows/docker.yml | 34 ------------------ docker-compose.yml | 2 +- 4 files changed, 57 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/action-deploy.yml create mode 100644 .github/workflows/actions.yml delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/action-deploy.yml b/.github/workflows/action-deploy.yml deleted file mode 100644 index dc11b39..0000000 --- a/.github/workflows/action-deploy.yml +++ /dev/null @@ -1,42 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Ansible Deployment - -# Controls when the workflow will run -on: - workflow_run: - workflows: ["Docker Build"] - types: - - completed - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - build: - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - - uses: actions/checkout@v2 - - - name: Run Ansible playbook - # uses: dawidd6/action-ansible-playbook@v2.5.0 - uses: dawidd6/action-ansible-playbook@671974ed60e946e11964cb0c26e69caaa4b1f559 - with: - playbook: playbook.yml - directory: ./ - key: ${{secrets.DEPLOY_SSH_KEY}} - inventory: | - [docker] - fluttershub.com - [docker:vars] - ansible_ssh_common_args='-o StrictHostKeyChecking=no' - ansible_ssh_user=deploy - options: | - --verbose - # Set to "true" if root is required for running your playbook - # sudo: false # optional - # Set to "true" if the Ansible output should not include colors (defaults to "false") - # no_color: # optional \ No newline at end of file diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml new file mode 100644 index 0000000..a238641 --- /dev/null +++ b/.github/workflows/actions.yml @@ -0,0 +1,56 @@ +name: Docker Build + +on: + push: + branches: + - main +env: + IMAGE_REPO: ghcr.io/hotarublaze + IMAGE_NAME: fluttershub + +jobs: + BuildImage: + runs-on: ubuntu-latest + # If running with act, Uncomment below + # container: phaze9/action-runner + env: + DOCKER_CONFIG: $HOME/.docker + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to ghcr.io + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: HotaruBlaze + password: ${{ secrets.CR_PAT }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: ${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:latest + Deploy: + runs-on: ubuntu-latest + steps: + - name: Run Ansible playbook + # uses: dawidd6/action-ansible-playbook@v2.5.0 + uses: dawidd6/action-ansible-playbook@671974ed60e946e11964cb0c26e69caaa4b1f559 + with: + playbook: playbook.yml + directory: ./ + key: ${{secrets.DEPLOY_SSH_KEY}} + inventory: | + [docker] + fluttershub.com + [docker:vars] + ansible_ssh_common_args='-o StrictHostKeyChecking=no' + ansible_ssh_user=deploy + options: | + --verbose + # Set to "true" if root is required for running your playbook + # sudo: false # optional + # Set to "true" if the Ansible output should not include colors (defaults to "false") + # no_color: # optional diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 0eb7847..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Docker Build - -on: - push: - branches: - - main -env: - IMAGE_REPO: ghcr.io/hotarublaze - IMAGE_NAME: fluttershub - -jobs: - main: - runs-on: ubuntu-latest - # If running with act, Uncomment below - # container: phaze9/action-runner - env: - DOCKER_CONFIG: $HOME/.docker - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to ghcr.io - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: HotaruBlaze - password: ${{ secrets.CR_PAT }} - - - name: Build and push - id: docker_build - uses: docker/build-push-action@v2 - with: - push: true - tags: ${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:latest \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 73f1080..39c73e8 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3" services: fluttershub.com: - image: registry.gitlab.com/mrflutters/fluttershub:latest + image: ghcr.io/hotarublaze/fluttershub:latest restart: always networks: - external