# Generated from xtask::workflows::extension_bump # Rebuild with `cargo xtask workflows`. name: extension_bump env: CARGO_TERM_COLOR: always RUST_BACKTRACE: '1' CARGO_INCREMENTAL: '0' ZED_EXTENSION_CLI_SHA: 7cfce605704d41ca247e3f84804bf323f6c6caaf on: workflow_call: inputs: bump-type: description: bump-type type: string default: patch secrets: app-id: description: The app ID used to create the PR required: true app-secret: description: The app secret for the corresponding app ID required: true jobs: check_extension: 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@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - id: cache-zed-extension-cli name: extension_tests::cache_zed_extension_cli uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 with: path: zed-extension key: zed-extension-${{ env.ZED_EXTENSION_CLI_SHA }} - name: extension_tests::download_zed_extension_cli if: steps.cache-zed-extension-cli.outputs.cache-hit != 'true' run: | wget --quiet "https://zed-extension-cli.nyc3.digitaloceanspaces.com/$ZED_EXTENSION_CLI_SHA/x86_64-unknown-linux-gnu/zed-extension" chmod +x zed-extension shell: bash -euxo pipefail {0} - name: extension_tests::check run: | mkdir -p /tmp/ext-scratch mkdir -p /tmp/ext-output ./zed-extension --source-dir . --scratch-dir /tmp/ext-scratch --output-dir /tmp/ext-output shell: bash -euxo pipefail {0} timeout-minutes: 1 check_bump_needed: 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@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false fetch-depth: 10 - id: compare-versions-check name: extension_bump::compare_versions run: | CURRENT_VERSION="$(sed -n 's/version = \"\(.*\)\"/\1/p' < extension.toml)" git checkout "$(git log -1 --format=%H)"~1 PREV_COMMIT_VERSION="$(sed -n 's/version = \"\(.*\)\"/\1/p' < extension.toml)" [[ "$CURRENT_VERSION" == "$PREV_COMMIT_VERSION" ]] && \ echo "needs_bump=true" >> "$GITHUB_OUTPUT" || \ echo "needs_bump=false" >> "$GITHUB_OUTPUT" echo "current_version=${CURRENT_VERSION}" >> "$GITHUB_OUTPUT" shell: bash -euxo pipefail {0} outputs: needs_bump: ${{ steps.compare-versions-check.outputs.needs_bump }} current_version: ${{ steps.compare-versions-check.outputs.current_version }} timeout-minutes: 1 bump_extension_version: needs: - check_extension - check_bump_needed if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') && needs.check_bump_needed.outputs.needs_bump == 'true' runs-on: namespace-profile-8x16-ubuntu-2204 steps: - id: generate-token name: extension_bump::generate_token uses: actions/create-github-app-token@v2 with: app-id: ${{ secrets.app-id }} private-key: ${{ secrets.app-secret }} - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - name: extension_bump::install_bump_2_version run: pip install bump2version shell: bash -euxo pipefail {0} - id: bump-version name: extension_bump::bump_version run: | OLD_VERSION="$(sed -n 's/version = \"\(.*\)\"/\1/p' < extension.toml)" cat < .bumpversion.cfg [bumpversion] current_version = "$OLD_VERSION" [bumpversion:file:Cargo.toml] [bumpversion:file:extension.toml] EOF bump2version --verbose ${{ inputs.bump-type }} NEW_VERSION="$(sed -n 's/version = \"\(.*\)\"/\1/p' < extension.toml)" cargo update --workspace rm .bumpversion.cfg echo "old_version=${OLD_VERSION}" >> "$GITHUB_OUTPUT" echo "new_version=${NEW_VERSION}" >> "$GITHUB_OUTPUT" shell: bash -euxo pipefail {0} - name: extension_bump::create_pull_request uses: peter-evans/create-pull-request@v7 with: title: Bump version to ${{ steps.bump-version.outputs.new_version }} body: This PR bumps the version of this extension to v${{ steps.bump-version.outputs.new_version }} commit-message: Bump version to v${{ steps.bump-version.outputs.new_version }} branch: bump-from-${{ steps.bump-version.outputs.old_version }} committer: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com> base: main delete-branch: true token: ${{ steps.generate-token.outputs.token }} sign-commits: true timeout-minutes: 1 create_version_label: needs: - check_extension - check_bump_needed if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions') && needs.check_bump_needed.outputs.needs_bump == 'false' runs-on: namespace-profile-8x16-ubuntu-2204 steps: - id: generate-token name: extension_bump::generate_token uses: actions/create-github-app-token@v2 with: app-id: ${{ secrets.app-id }} private-key: ${{ secrets.app-secret }} - name: steps::checkout_repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 with: clean: false - name: extension_bump::create_version_tag uses: actions/github-script@v7 with: script: |- github.rest.git.createRef({ owner: context.repo.owner, repo: context.repo.repo, ref: 'refs/tags/v${{ needs.check_bump_needed.outputs.current_version }}', sha: context.sha }) github-token: ${{ steps.generate-token.outputs.token }} timeout-minutes: 1 concurrency: group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.ref_name == 'main' && github.sha || 'anysha' }} cancel-in-progress: true