This commit is contained in:
2025-04-17 16:08:41 +03:00
parent d135fc2dc4
commit 0ad4a5b0ce
2 changed files with 65 additions and 44 deletions

View File

@@ -30,48 +30,10 @@ jobs:
CR_REPO: ${{ github.event.repository.name }}
TAG: ${{ inputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Yandex Cloud Login
uses: yc-actions/yc-cr-login@v2
- name: deploy
uses: https://bb.hublab.ru/HUB/workflows/.gitea/actions/deploy@HEAD
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: Save envs
run: |
echo '${{ toJson(steps.vault.outputs) }}' > output.json
jq -r 'to_entries[] | "\(.key)=\"\(.value)\""' output.json > .env
source .env
cat .env
- name: Pull
env:
DOCKER_HOST: tcp://${{ inputs.host }}:2376
run: |
docker compose pull
- name: Migrate
if: ${{ inputs.migrate == 'true' }}
env:
DOCKER_HOST: tcp://${{ inputs.host }}:2376
run: |
docker compose run --rm ${CR_REPO:8} alembic upgrade head
- name: Build
if: ${{ inputs.build == 'true' }}
env:
DOCKER_HOST: tcp://${{ inputs.host }}:2376
run: |
docker compose build
- name: Deploy
env:
DOCKER_HOST: tcp://${{ inputs.host }}:2376
run: |
docker compose -p ${{ inputs.environment }} up -d --force-recreate
secrets: ${{ toJSON(secrets) }}
environment: ${{ inputs.environment }}
tag: ${{ inputs.tag }}
migrate: ${{ inputs.migrate }}