From 2212ea743377f05ef860bf8079777c149f4618dd Mon Sep 17 00:00:00 2001 From: Kirill Andrusyak <32839298+franze6@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:46:40 +0300 Subject: [PATCH] Create docker-image.yml --- .github/workflows/docker-image.yml | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..6dd1962 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,64 @@ +name: Build and deploy + +on: + push: + branches: + - 'master' + tags: + - '*' + paths-ignore: + - '.github/**' + pull_request: + branches: + - 'master' + tags: + - '*' + paths-ignore: + - '.github/**' + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + +jobs: + build: + runs-on: self-hosted + steps: + - name: Get branch data + uses: actions/checkout@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push image + uses: docker/build-push-action@v2 + with: + push: true + tags: kandrusyak/blockchain-ui:master + deploy: + needs: build + name: Deploy to host + runs-on: self-hosted + steps: + - name: Get branch data + uses: actions/checkout@v2 + + - name: Deploying changes + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + password: ${{ secrets.SSH_PASSWORD }} + script: | + docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} + ./update.sh