From ff77014241f57c9926057a1b5a20ed2b94d6c436 Mon Sep 17 00:00:00 2001 From: Sergio Ribera <56278796+SergioRibera@users.noreply.github.com> Date: Fri, 27 Sep 2024 02:37:34 -0400 Subject: [PATCH] ci: add release plugin pipeline into zed registry --- .github/workflows/publish-plugin.yml | 26 ++++++++++++++++++ .github/workflows/release.yml | 41 ++++++++++++++++++++++++++-- Cargo.toml | 4 +-- 3 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish-plugin.yml diff --git a/.github/workflows/publish-plugin.yml b/.github/workflows/publish-plugin.yml new file mode 100644 index 0000000..2f6c6a6 --- /dev/null +++ b/.github/workflows/publish-plugin.yml @@ -0,0 +1,26 @@ +name: Release Plugin into Zed Store + +on: + # Defining workflow_call means that this workflow can be called from + # your main workflow job + workflow_call: + # cargo-dist exposes the plan from the plan step, as a JSON string, + # to your job if it needs it + inputs: + plan: + required: true + type: string + +jobs: + publish-extension: + name: Release Zed Extension + runs-on: ubuntu-latest + if: ${{ inputs.plan && fromJson(inputs.plan).announcement_is_prerelease != false }} + steps: + - uses: huacnlee/zed-extension-action@v1 + with: + extension-name: dotenv-zed + push-to: RustLangES/zed-extensions + env: + # the personal access token should have "repo" & "workflow" scopes + COMMITTER_TOKEN: ${{ secrets.ZED_PLUGIN_COMMITTER_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76ba0d7..18e20ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,5 @@ +# This file was autogenerated by cargo-dist: https://opensource.axo.dev/cargo-dist/ +# # Copyright 2022-2024, axodotdev # SPDX-License-Identifier: MIT or Apache-2.0 # @@ -61,7 +63,7 @@ jobs: # we specify bash to get pipefail; it guards against the `curl` command # failing. otherwise `sh` won't catch that `curl` returned non-0 shell: bash - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.0/cargo-dist-installer.sh | sh" + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.22.1/cargo-dist-installer.sh | sh" - name: Cache cargo-dist uses: actions/upload-artifact@v4 with: @@ -299,20 +301,55 @@ jobs: name=$(echo "$filename" | sed "s/\.rb$//") version=$(echo "$release" | jq .app_version --raw-output) + export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH" + brew update + # We avoid reformatting user-provided data such as the app description and homepage. + brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true + git add "Formula/${filename}" git commit -m "${name} ${version}" done git push + custom-cliff: + needs: + - plan + - host + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + uses: ./.github/workflows/cliff.yml + with: + plan: ${{ needs.plan.outputs.val }} + secrets: inherit + # publish jobs get escalated permissions + permissions: + "id-token": "write" + "packages": "write" + + custom-publish-plugin: + needs: + - plan + - host + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + uses: ./.github/workflows/publish-plugin.yml + with: + plan: ${{ needs.plan.outputs.val }} + secrets: inherit + # publish jobs get escalated permissions + permissions: + "id-token": "write" + "packages": "write" + announce: needs: - plan - host - publish-homebrew-formula + - custom-cliff + - custom-publish-plugin # use "always() && ..." to allow us to wait for all publish jobs while # still allowing individual publish jobs to skip themselves (for prereleases). # "host" however must run to completion, no skipping allowed! - if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }} + if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') && (needs.custom-cliff.result == 'skipped' || needs.custom-cliff.result == 'success') && (needs.custom-publish-plugin.result == 'skipped' || needs.custom-publish-plugin.result == 'success') }} runs-on: "ubuntu-20.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index 0b2e8d0..457c3e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ lto = "thin" # Config for 'cargo dist' [workspace.metadata.dist] # The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.21.0" +cargo-dist-version = "0.22.1" # CI backends to support ci = "github" # The installers to generate for each app @@ -37,6 +37,6 @@ targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux- # Path that installers should place binaries in install-path = "CARGO_HOME" # Publish jobs to run in CI -publish-jobs = ["homebrew", "./cliff"] +publish-jobs = ["homebrew", "./cliff", "./publish-plugin"] # Whether to install an updater program install-updater = false