mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-24 21:59:04 +00:00
80 lines
2.9 KiB
YAML
80 lines
2.9 KiB
YAML
# Generated from xtask::workflows::extension_auto_bump
|
|
# Rebuild with `cargo xtask workflows`.
|
|
name: extension_auto_bump
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- extensions/**
|
|
- '!extensions/test-extension/**'
|
|
- '!extensions/workflows/**'
|
|
- '!extensions/*.md'
|
|
jobs:
|
|
detect_changed_extensions:
|
|
if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
|
|
runs-on: namespace-profile-2x4-ubuntu-2404
|
|
steps:
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
fetch-depth: 2
|
|
- id: detect
|
|
name: extension_auto_bump::detect_changed_extensions
|
|
run: |
|
|
COMPARE_REV="$(git rev-parse HEAD~1)"
|
|
CHANGED_FILES="$(git diff --name-only "$COMPARE_REV" "$GITHUB_SHA")"
|
|
# Detect changed extension directories (excluding extensions/workflows)
|
|
CHANGED_EXTENSIONS=$(echo "$CHANGED_FILES" | grep -oP '^extensions/[^/]+(?=/)' | sort -u | grep -v '^extensions/workflows$' || true)
|
|
# Filter out deleted extensions
|
|
EXISTING_EXTENSIONS=""
|
|
for ext in $CHANGED_EXTENSIONS; do
|
|
if [ -f "$ext/extension.toml" ]; then
|
|
EXISTING_EXTENSIONS=$(printf '%s\n%s' "$EXISTING_EXTENSIONS" "$ext")
|
|
fi
|
|
done
|
|
CHANGED_EXTENSIONS=$(echo "$EXISTING_EXTENSIONS" | sed '/^$/d')
|
|
if [ -n "$CHANGED_EXTENSIONS" ]; then
|
|
EXTENSIONS_JSON=$(echo "$CHANGED_EXTENSIONS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
|
|
else
|
|
EXTENSIONS_JSON="[]"
|
|
fi
|
|
# Filter out newly added extensions
|
|
FILTERED="[]"
|
|
for ext in $(echo "$EXTENSIONS_JSON" | jq -r '.[]'); do
|
|
if git show HEAD~1:"$ext/extension.toml" >/dev/null 2>&1; then
|
|
FILTERED=$(echo "$FILTERED" | jq -c --arg e "$ext" '. + [$e]')
|
|
fi
|
|
done
|
|
echo "changed_extensions=$FILTERED" >> "$GITHUB_OUTPUT"
|
|
outputs:
|
|
changed_extensions: ${{ steps.detect.outputs.changed_extensions }}
|
|
timeout-minutes: 5
|
|
bump_extension_versions:
|
|
needs:
|
|
- detect_changed_extensions
|
|
if: needs.detect_changed_extensions.outputs.changed_extensions != '[]'
|
|
permissions:
|
|
actions: write
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
strategy:
|
|
matrix:
|
|
extension: ${{ fromJson(needs.detect_changed_extensions.outputs.changed_extensions) }}
|
|
fail-fast: false
|
|
max-parallel: 1
|
|
uses: ./.github/workflows/extension_bump.yml
|
|
secrets:
|
|
app-id: ${{ secrets.ZED_ZIPPY_APP_ID }}
|
|
app-secret: ${{ secrets.ZED_ZIPPY_APP_PRIVATE_KEY }}
|
|
with:
|
|
working-directory: ${{ matrix.extension }}
|
|
force-bump: false
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }}
|
|
cancel-in-progress: true
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|