This commit is contained in:
@@ -7,7 +7,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "./docker-compose.misc.yml"
|
||||
- "**/docker-compose*.yml"
|
||||
|
||||
env:
|
||||
VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||
@@ -25,37 +25,13 @@ jobs:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
||||
|
||||
- name: Install Vault
|
||||
uses: cpanato/vault-installer@main
|
||||
with:
|
||||
version: ${{ env.HC_VAULT_VERSION }}
|
||||
|
||||
- name: Detect Renovate update type
|
||||
id: detect-update
|
||||
env:
|
||||
PR_BODY: ${{ github.event.pull_request.body }}
|
||||
run: |
|
||||
echo "PR body: $PR_BODY"
|
||||
|
||||
if echo "$PR_BODY" | grep -qE 'Update Type: (patch|minor|major|digest)'; then
|
||||
echo "update=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "update=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Stop if update not patch/minor/major/digest
|
||||
if: steps.detect-update.outputs.update != 'true'
|
||||
run: |
|
||||
echo "::warning::This PR does not involve patch/minor/major/digest update. Skipping deployment."
|
||||
exit 0
|
||||
|
||||
- name: Get changed services from docker-compose.yml
|
||||
- name: Get changed services from all Compose files.
|
||||
id: services
|
||||
run: |
|
||||
echo "Getting services from main and ${{ github.ref_name }}"
|
||||
|
||||
# Dynamically find all docker-compose YAML files (root + compose folder)
|
||||
COMPOSE_FILES=($(find . -maxdepth 2 -type f -name 'docker-compose*.yml' | sort))
|
||||
COMPOSE_FILES=($(find . -type f -name 'docker-compose*.yml' | sort))
|
||||
|
||||
echo "Found Compose files:"
|
||||
printf '%s\n' "${COMPOSE_FILES[@]}"
|
||||
@@ -140,18 +116,18 @@ jobs:
|
||||
echo "compose_list=$compose_list" >> "$GITHUB_OUTPUT"
|
||||
echo "Compose files: $compose_list"
|
||||
|
||||
- name: Generate .env file for Docker Compose
|
||||
run: |
|
||||
vault kv get -format=json benedikta-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
env:
|
||||
DOCKER_HOST: tcp://192.168.1.252:2375
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USER }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
env:
|
||||
DOCKER_HOST: tcp://192.168.1.252:2375
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ secrets.GHCR_USER }}
|
||||
@@ -159,6 +135,8 @@ jobs:
|
||||
|
||||
- name: Login to Private Gitea Registry
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
env:
|
||||
DOCKER_HOST: tcp://192.168.1.252:2375
|
||||
with:
|
||||
registry: git.trez.wtf
|
||||
username: ${{ secrets.BOT_GITEA_USER }}
|
||||
@@ -172,6 +150,15 @@ jobs:
|
||||
notification_title: "GITEA: [RENOVATE] Docker Compose Deployment @ Rikku"
|
||||
notification_message: "Starting Docker Compose run..."
|
||||
|
||||
- name: Generate .env from Hashicorp Vault
|
||||
uses: https://git.trez.wtf/Trez/hc-vault-env@main
|
||||
with:
|
||||
HC_VAULT_VERSION: ${{ env.HC_VAULT_VERSION }}
|
||||
HC_VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||
HC_VAULT_USERNAME: ${{ secrets.VAULT_GITEA_USER }}
|
||||
HC_VAULT_PASSWORD: ${{ secrets.VAULT_GITEA_PASSWORD }}
|
||||
HC_VAULT_SECRETS_PATH: benedikta-docker/env
|
||||
|
||||
- name: Docker Compose Deployment
|
||||
uses: cssnr/stack-deploy-action@d58b92bcd776afc57ef12f55bafff71200fd218e # v1.4.0
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user