Browse Source

Try changing env var name

master
Fábio Kaiser Rauber 2 weeks ago
parent
commit
5d7998eaa2
  1. 12
      .drone.yml

12
.drone.yml

@ -27,10 +27,10 @@ steps:
image: alpine:latest image: alpine:latest
commands: commands:
- apk add --no-cache curl jq - 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" - "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: environment:
GITEA_API_KEY: GITEATOKEN:
from_secret: gitea-api-key from_secret: gitea-api-key
depends_on: depends_on:
- package-changed-charts - package-changed-charts
@ -48,8 +48,8 @@ steps:
image: alpine/git image: alpine/git
commands: commands:
# Debug: Verify API key presence # Debug: Verify API key presence
- "test -n \"$GITEA_API_KEY\" || { echo \"GITEA_API_KEY is not set\"; exit 1; }" - "test -n \"$GITEATOKEN\" || { echo \"GITEATOKEN is not set\"; exit 1; }"
- "echo \"Key: ${GITEA_API_KEY}\"" - "echo \"Key: ${GITEATOKEN}\""
# Check if gh-pages exists remotely, fetch it if it does, otherwise create it # 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 - 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) # Stage the charts/dist directory (already in the working directory)
@ -57,10 +57,10 @@ steps:
# Commit changes # Commit changes
- git commit -m "Update Helm charts from commit ${DRONE_COMMIT}" || echo "No changes to commit" - git commit -m "Update Helm charts from commit ${DRONE_COMMIT}" || echo "No changes to commit"
# Push with API key, ensuring proper variable expansion # 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; }" - "git push \"$PUSH_URL\" HEAD:gh-pages --force || { echo \"Git push failed\"; exit 1; }"
environment: environment:
GITEA_API_KEY: GITEATOKEN:
from_secret: gitea-api-key from_secret: gitea-api-key
when: when:
condition: ls charts/dist/*.tgz 2>/dev/null # Only run if there are new .tgz files condition: ls charts/dist/*.tgz 2>/dev/null # Only run if there are new .tgz files

Loading…
Cancel
Save