Add redis compose #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Portainer deploy | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "services/**" | |
| - "apps/**" | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| stack: | |
| # Add more stacks by extending this list with {name, path, secret} | |
| - { | |
| name: cloudflared, | |
| path: "services/cloudflared/", | |
| secret: "PORTAINER_WEBHOOK_CLOUDFLARED", | |
| } | |
| - { | |
| name: hello, | |
| path: "services/hello/", | |
| secret: "PORTAINER_WEBHOOK_HELLO", | |
| } | |
| - { | |
| name: open-webui, | |
| path: "apps/open-webui/", | |
| secret: "PORTAINER_WEBHOOK_OPEN_WEBUI", | |
| } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Trigger ${{ matrix.stack.name }} | |
| env: | |
| WEBHOOK: ${{ secrets[matrix.stack.secret] }} | |
| STACK_PATH: ${{ matrix.stack.path }} | |
| BEFORE: ${{ github.event.before }} | |
| SHA: ${{ github.sha }} | |
| SECRET_NAME: ${{ matrix.stack.secret }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${WEBHOOK}" ]; then | |
| echo "No webhook secret set for ${STACK_PATH} (secret ${SECRET_NAME}); skipping." | |
| exit 0 | |
| fi | |
| if [ -n "${BEFORE}" ] && ! git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then | |
| git fetch --no-tags origin "${BEFORE}" --depth=1 | |
| fi | |
| changed=$(git diff --name-only "${BEFORE:-${SHA}^}" "${SHA}" || true) | |
| if ! printf '%s\n' "${changed}" | grep -q "${STACK_PATH}"; then | |
| echo "No changes for ${STACK_PATH}; skipping." | |
| exit 0 | |
| fi | |
| echo "Triggering webhook for ${STACK_PATH} (secret ${SECRET_NAME})" | |
| curl -fsS -X POST "${WEBHOOK}" |