Skip to content

Commit

Permalink
ci: add release plugin pipeline into zed registry
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera committed Sep 29, 2024
1 parent d130a31 commit ff77014
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/publish-plugin.yml
Original file line number Diff line number Diff line change
@@ -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 }}
41 changes: 39 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit ff77014

Please sign in to comment.