From ca667cd872a13dbe2df7e749902f51a922e621a7 Mon Sep 17 00:00:00 2001 From: Nikita Andriyanov Date: Thu, 26 Dec 2024 14:24:33 +0300 Subject: [PATCH] add deploy reusable --- .github/workflows/deploy.yaml | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..7b27f05 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,47 @@ +on: + workflow_call: + inputs: + tag: + required: false + type: string + default: latest + debug: + required: false + type: boolean + default: false + environment: + type: string + required: true + host: + type: string + required: true + +jobs: + deploy: + runs-on: gpu + env: + TAG: ${{ inputs.tag }} + steps: + - name: Checkout + uses: actions/checkout@master + - name: Yandex Cloud Login + uses: yc-actions/yc-cr-login@v2 + with: + yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }} + - name: Import Secrets + uses: hashicorp/vault-action@v2 + id: vault + with: + url: https://vault.hublab.ru/ + method: approle + roleId: ${{ secrets.VAULT_ROLE_ID }} + secretId: ${{ secrets.VAULT_SECRET_ID }} + secrets: | + hub/data/tach/${{ inputs.environment }}/base * ; + hub/data/tach/${{ inputs.environment }}/${{github.event.repository.name}} * ; + - name: Deploy + env: + DOCKER_HOST: tcp://${{ inputs.host }}:2376 + run: | + docker compose pull + docker compose up -d \ No newline at end of file