|
|
@ -27,10 +27,10 @@ steps: |
|
|
|
image: alpine:latest |
|
|
|
commands: |
|
|
|
- apk add --no-cache curl jq |
|
|
|
- "LATEST_TAG=$(curl -s -H \"Authorization: token $GITEA_API_KEY\" https://git.interlegis.leg.br/api/v1/repos/SEIT/rancher-charts/releases?limit=1 | jq -r '.[0].tag_name')" |
|
|
|
- "LATEST_TAG=$(curl -s -H \"Authorization: token $GITEATOKEN\" https://git.interlegis.leg.br/api/v1/repos/SEIT/rancher-charts/releases?limit=1 | jq -r '.[0].tag_name')" |
|
|
|
- "if [ -n \"$LATEST_TAG\" ]; then curl -L -o charts/dist/index.yaml https://git.interlegis.leg.br/SEIT/rancher-charts/releases/download/$LATEST_TAG/index.yaml || true; fi" |
|
|
|
environment: |
|
|
|
GITEA_API_KEY: |
|
|
|
GITEATOKEN: |
|
|
|
from_secret: gitea-api-key |
|
|
|
depends_on: |
|
|
|
- package-changed-charts |
|
|
@ -48,8 +48,8 @@ steps: |
|
|
|
image: alpine/git |
|
|
|
commands: |
|
|
|
# Debug: Verify API key presence |
|
|
|
- "test -n \"$GITEA_API_KEY\" || { echo \"GITEA_API_KEY is not set\"; exit 1; }" |
|
|
|
- "echo \"Key: ${GITEA_API_KEY}\"" |
|
|
|
- "test -n \"$GITEATOKEN\" || { echo \"GITEATOKEN is not set\"; exit 1; }" |
|
|
|
- "echo \"Key: ${GITEATOKEN}\"" |
|
|
|
# Check if gh-pages exists remotely, fetch it if it does, otherwise create it |
|
|
|
- git ls-remote --heads origin gh-pages | grep -q gh-pages && git fetch origin gh-pages && git checkout gh-pages || git checkout -b gh-pages |
|
|
|
# Stage the charts/dist directory (already in the working directory) |
|
|
@ -57,10 +57,10 @@ steps: |
|
|
|
# Commit changes |
|
|
|
- git commit -m "Update Helm charts from commit ${DRONE_COMMIT}" || echo "No changes to commit" |
|
|
|
# Push with API key, ensuring proper variable expansion |
|
|
|
- "PUSH_URL=\"https://x:${GITEA_API_KEY}@git.interlegis.leg.br/SEIT/rancher-charts.git\"" |
|
|
|
- "PUSH_URL=\"https://x:${GITEATOKEN}@git.interlegis.leg.br/SEIT/rancher-charts.git\"" |
|
|
|
- "git push \"$PUSH_URL\" HEAD:gh-pages --force || { echo \"Git push failed\"; exit 1; }" |
|
|
|
environment: |
|
|
|
GITEA_API_KEY: |
|
|
|
GITEATOKEN: |
|
|
|
from_secret: gitea-api-key |
|
|
|
when: |
|
|
|
condition: ls charts/dist/*.tgz 2>/dev/null # Only run if there are new .tgz files |
|
|
|