дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 17:21:13 +02:00
The signing keys and tokens are repository secrets, readable by any workflow on any branch, and secrets: inherit hands them all to the called release workflows. The jobs that read a secret other than GITHUB_TOKEN now name environment: release (plugins, plugin-keys, build, server-signatures, mirror, cask). secrets: inherit stays until the secrets move into the environment, so releases build and sign as before; the environment is created on first use with no rules. Refs #6701. Co-authored-by: bertyhell <[email protected]>
76 рядки
2.8 KiB
YAML
76 рядки
2.8 KiB
YAML
name: Homebrew
|
|
|
|
# Updates the cask in the project tap, l0ng-ai/homebrew-tap (scripts/homebrew-cask.ts), so
|
|
# `brew install --cask l0ng-ai/tap/openidea` installs the new release. Release runs it after
|
|
# publishing; run it by hand to write the cask of an existing tag again. Skipped for prereleases
|
|
# and without the HOMEBREW_TAP_DEPLOY_KEY secret (the private half of a write deploy key on
|
|
# l0ng-ai/homebrew-tap).
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
tag: { type: string, required: true }
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Published stable release to write the cask for (e.g. v0.1.51)"
|
|
required: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: homebrew-tap
|
|
|
|
jobs:
|
|
cask:
|
|
environment: release
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
TAP: l0ng-ai/homebrew-tap
|
|
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
|
|
GH_TOKEN: ${{ github.token }}
|
|
steps:
|
|
- name: Check tag and deploy key
|
|
id: check
|
|
run: |
|
|
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
echo "::notice::$TAG is not a stable release: the cask stays as is"
|
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
elif [ -z "$HOMEBREW_TAP_DEPLOY_KEY" ]; then
|
|
echo "::notice::HOMEBREW_TAP_DEPLOY_KEY unset: not updating the cask for $TAG"
|
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
if: steps.check.outputs.skip != 'true'
|
|
with: { sparse-checkout: scripts }
|
|
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
|
|
if: steps.check.outputs.skip != 'true'
|
|
with:
|
|
repository: ${{ env.TAP }}
|
|
ssh-key: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
|
|
path: tap
|
|
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
|
if: steps.check.outputs.skip != 'true'
|
|
with: { node-version: 22 }
|
|
- name: Download DMGs
|
|
if: steps.check.outputs.skip != 'true'
|
|
run: gh release download "$TAG" -R "$GITHUB_REPOSITORY" -p '*.dmg' -D assets
|
|
- name: Write the cask
|
|
if: steps.check.outputs.skip != 'true'
|
|
run: node scripts/homebrew-cask.ts "$TAG" assets tap/Casks/openidea.rb
|
|
- name: Push to the tap
|
|
if: steps.check.outputs.skip != 'true'
|
|
working-directory: tap
|
|
run: |
|
|
git add Casks/openidea.rb
|
|
if git diff --cached --quiet; then
|
|
echo "the cask is already at ${TAG#v}"
|
|
exit 0
|
|
fi
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git commit -m "openidea ${TAG#v}"
|
|
git push
|