|
| 1 | +name: Update SDK library versions |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '17 6 * * *' # Daily at 6:17 UTC |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + update-versions: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Fetch latest SDK releases and update libraries.mdx |
| 19 | + env: |
| 20 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + run: | |
| 22 | + FILE="main/docs/libraries.mdx" |
| 23 | +
|
| 24 | + # Fetches releases/latest for a repo and updates badge + date for a subtext. |
| 25 | + # Falls back to tags if no formal releases exist. |
| 26 | + update_sdk() { |
| 27 | + local subtext="$1" |
| 28 | + local repo="$2" |
| 29 | + local tag pub_date release |
| 30 | +
|
| 31 | + release=$(gh api "repos/${repo}/releases/latest" 2>/dev/null) |
| 32 | +
|
| 33 | + if [ -n "$release" ]; then |
| 34 | + tag=$(echo "$release" | jq -r '.tag_name') |
| 35 | + pub_date=$(echo "$release" | jq -r '.published_at') |
| 36 | + else |
| 37 | + local tags sha |
| 38 | + tags=$(gh api "repos/${repo}/tags" 2>/dev/null) |
| 39 | + tag=$(echo "$tags" | jq -r '.[0].name // empty') |
| 40 | + sha=$(echo "$tags" | jq -r '.[0].commit.sha // empty') |
| 41 | + if [ -z "$tag" ]; then |
| 42 | + echo " No release or tag found for ${repo} — skipping" |
| 43 | + return |
| 44 | + fi |
| 45 | + pub_date=$(gh api "repos/${repo}/commits/${sha}" 2>/dev/null | jq -r '.commit.committer.date // empty') |
| 46 | + pub_date="${pub_date:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}" |
| 47 | + fi |
| 48 | +
|
| 49 | + local fmt_date |
| 50 | + fmt_date=$(date -d "$pub_date" '+%b %-d, %Y') |
| 51 | + echo " ${subtext}: ${tag} (${fmt_date})" |
| 52 | +
|
| 53 | + sed -i "/subtext: \"${subtext}\"/,/}}\/>/{ |
| 54 | + s|badge: \"[^\"]*\"|badge: \"${tag}\"| |
| 55 | + s|date: \"[^\"]*\"|date: \"${fmt_date}\"| |
| 56 | + }" "$FILE" |
| 57 | + } |
| 58 | +
|
| 59 | + # Fetches releases filtered by a tag prefix (for monorepos). |
| 60 | + # strip_prefix="true" removes the prefix from the displayed badge value. |
| 61 | + update_sdk_prefixed() { |
| 62 | + local subtext="$1" |
| 63 | + local repo="$2" |
| 64 | + local prefix="$3" |
| 65 | + local strip_prefix="${4:-false}" |
| 66 | + local releases tag pub_date display_tag fmt_date |
| 67 | +
|
| 68 | + releases=$(gh api "repos/${repo}/releases?per_page=20") |
| 69 | + tag=$(echo "$releases" | jq -r --arg p "$prefix" \ |
| 70 | + '[.[] | select(.tag_name | startswith($p))][0].tag_name // empty') |
| 71 | + pub_date=$(echo "$releases" | jq -r --arg p "$prefix" \ |
| 72 | + '[.[] | select(.tag_name | startswith($p))][0].published_at // empty') |
| 73 | +
|
| 74 | + if [ -z "$tag" ]; then |
| 75 | + echo " No release with prefix '${prefix}' for ${repo} — skipping" |
| 76 | + return |
| 77 | + fi |
| 78 | +
|
| 79 | + display_tag="$tag" |
| 80 | + if [ "$strip_prefix" = "true" ]; then |
| 81 | + display_tag="${tag#${prefix}}" |
| 82 | + fi |
| 83 | +
|
| 84 | + fmt_date=$(date -d "$pub_date" '+%b %-d, %Y') |
| 85 | + echo " ${subtext}: ${display_tag} (${fmt_date})" |
| 86 | +
|
| 87 | + sed -i "/subtext: \"${subtext}\"/,/}}\/>/{ |
| 88 | + s|badge: \"[^\"]*\"|badge: \"${display_tag}\"| |
| 89 | + s|date: \"[^\"]*\"|date: \"${fmt_date}\"| |
| 90 | + }" "$FILE" |
| 91 | + } |
| 92 | +
|
| 93 | + # --- SPA SDKs --- |
| 94 | + update_sdk "auth0-react" "auth0/auth0-react" |
| 95 | + update_sdk "auth0-vue" "auth0/auth0-vue" |
| 96 | + update_sdk "auth0-angular" "auth0/auth0-angular" |
| 97 | + update_sdk "auth0-spa-js" "auth0/auth0-spa-js" |
| 98 | + update_sdk_prefixed "auth0-flutter" "auth0/auth0-flutter" "af-v" "false" |
| 99 | +
|
| 100 | + # --- Regular Web App SDKs --- |
| 101 | + update_sdk "nextjs-auth0" "auth0/nextjs-auth0" |
| 102 | + update_sdk "express-openid-connect" "auth0/express-openid-connect" |
| 103 | + update_sdk_prefixed "auth0-fastify" "auth0/auth0-fastify" "auth0-fastify-v" "true" |
| 104 | + update_sdk_prefixed "auth0-nuxt" "auth0/auth0-nuxt" "auth0-nuxt-v" "true" |
| 105 | + update_sdk "auth0-aspnetcore-authentication" "auth0/auth0-aspnetcore-authentication" |
| 106 | + update_sdk "laravel-auth0" "auth0/laravel-auth0" |
| 107 | + update_sdk "okta-spring-boot" "auth0/auth0-auth-java" |
| 108 | + update_sdk "auth0-python" "auth0/auth0-python" |
| 109 | + update_sdk "auth0-php" "auth0/auth0-php" |
| 110 | + update_sdk "omniauth-auth0" "auth0/omniauth-auth0" |
| 111 | + update_sdk "auth0-java-mvc-common" "auth0/auth0-java-mvc-common" |
| 112 | + update_sdk "auth0-hono" "auth0-lab/auth0-hono" |
| 113 | +
|
| 114 | + # --- Backend / API SDKs --- |
| 115 | + update_sdk "node-oauth2-jwt-bearer" "auth0/node-oauth2-jwt-bearer" |
| 116 | + update_sdk_prefixed "auth0-fastify-api" "auth0/auth0-fastify" "auth0-fastify-api-v" "true" |
| 117 | + update_sdk "go-jwt-middleware" "auth0/go-jwt-middleware" |
| 118 | + update_sdk "auth0-PHP" "auth0/auth0-php" |
| 119 | +
|
| 120 | + # --- Native / Mobile SDKs --- |
| 121 | + update_sdk "react-native-auth0" "auth0/react-native-auth0" |
| 122 | + update_sdk "Auth0.swift" "auth0/Auth0.swift" |
| 123 | + update_sdk "Auth0.Android" "auth0/Auth0.Android" |
| 124 | + update_sdk_prefixed "auth0-oidc-client-net" "auth0/auth0-oidc-client-net" "ios-" "false" |
| 125 | +
|
| 126 | + # --- Management API SDKs --- |
| 127 | + update_sdk "auth0.net" "auth0/auth0.net" |
| 128 | + update_sdk "go-auth0" "auth0/go-auth0" |
| 129 | + update_sdk "auth0-java" "auth0/auth0-java" |
| 130 | + update_sdk "node-auth0" "auth0/node-auth0" |
| 131 | + update_sdk "ruby-auth0" "auth0/ruby-auth0" |
| 132 | +
|
| 133 | + # --- Lock SDKs --- |
| 134 | + update_sdk "Lock.Android" "auth0/Lock.Android" |
| 135 | + update_sdk "Lock.swift" "auth0/Lock.swift" |
| 136 | + update_sdk "lock" "auth0/lock" |
| 137 | +
|
| 138 | + echo "--- Done ---" |
| 139 | +
|
| 140 | + - name: Open PR if versions changed |
| 141 | + env: |
| 142 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 143 | + run: | |
| 144 | + git add main/docs/libraries.mdx |
| 145 | + if git diff --cached --quiet; then |
| 146 | + echo "All SDK versions are already up to date — nothing to do." |
| 147 | + exit 0 |
| 148 | + fi |
| 149 | +
|
| 150 | + BRANCH="chore/sdk-version-update-$(date +%Y%m%d)" |
| 151 | +
|
| 152 | + if gh pr list --head "$BRANCH" --state open --json number --jq 'length' | grep -qv '^0$'; then |
| 153 | + echo "Open PR already exists for ${BRANCH} — skipping." |
| 154 | + exit 0 |
| 155 | + fi |
| 156 | +
|
| 157 | + git config user.name "github-actions[bot]" |
| 158 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 159 | +
|
| 160 | + git checkout -b "$BRANCH" |
| 161 | + git commit -m "chore: update SDK library versions $(date +%Y-%m-%d)" |
| 162 | + git push origin "$BRANCH" |
| 163 | +
|
| 164 | + gh pr create \ |
| 165 | + --title "chore: update SDK library versions" \ |
| 166 | + --body "Automated daily sync of SDK version badges and release dates in \`main/docs/libraries.mdx\`. |
| 167 | +
|
| 168 | + Each \`badge\` and \`date\` was updated by fetching the latest GitHub release for the corresponding SDK repository. |
| 169 | +
|
| 170 | + --- |
| 171 | + Auto-generated by [update-sdk-versions]($(gh repo view --json url -q .url)/blob/main/.github/workflows/update-sdk-versions.yml). Approve to deploy." \ |
| 172 | + --head "$BRANCH" \ |
| 173 | + --base main \ |
| 174 | + --label "sdk-version-autoupdate" |
0 commit comments