diff --git a/.github/workflows/bump-sq-kgoose-formula.yml b/.github/workflows/bump-sq-kgoose-formula.yml deleted file mode 100644 index da2050b35..000000000 --- a/.github/workflows/bump-sq-kgoose-formula.yml +++ /dev/null @@ -1,129 +0,0 @@ -# When you push a bb-cli release tag to this repo, tell squareup/homebrew-formulas -# to bump the version of sq-kgoose.rb. -name: Bump sq-kgoose Formula - -on: - push: - tags: - - 'v[0-9]*.[0-9]*.[0-9]*' - - '[0-9]*.[0-9]*.[0-9]*' - workflow_dispatch: - inputs: - tag: - description: Git tag - required: true - -concurrency: - group: bump-sq-kgoose-formula-${{ github.event.inputs.tag || github.ref_name }} - cancel-in-progress: false - -permissions: - contents: read - -jobs: - bump-formula: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - with: - ref: ${{ github.event.inputs.tag || github.ref }} - fetch-depth: 0 - - - name: Prepare formula bump - id: vars - env: - INPUT_TAG: ${{ github.event.inputs.tag }} - REF_NAME: ${{ github.ref_name }} - EVENT_NAME: ${{ github.event_name }} - run: | - set -euo pipefail - - tag="${INPUT_TAG:-$REF_NAME}" - if [[ ! "$tag" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "formula bump tags must be semver like v0.1.0 or 0.1.0; got: $tag" >&2 - exit 1 - fi - - manifest_version="$(sed -n 's/^version = "\([^"]*\)"/\1/p' bb-cli/Cargo.toml | head -n1)" - if [[ -z "$manifest_version" ]]; then - echo "failed to read version from bb-cli/Cargo.toml" >&2 - exit 1 - fi - - should_dispatch=true - if [[ "$EVENT_NAME" != "workflow_dispatch" ]]; then - tag_ref="refs/tags/$tag" - previous_tag="$( - git for-each-ref refs/tags \ - --sort=-creatordate \ - --format='%(refname)' \ - | grep -E '^refs/tags/v?[0-9]+\.[0-9]+\.[0-9]+$' \ - | grep -v -Fx "$tag_ref" \ - | while read -r candidate; do - if git merge-base --is-ancestor "$candidate" HEAD; then - printf '%s\n' "${candidate#refs/tags/}" - break - fi - done - )" - - if [[ -n "$previous_tag" ]]; then - previous_manifest_version="" - if previous_manifest="$(git show "${previous_tag}:bb-cli/Cargo.toml" 2>/dev/null)"; then - previous_manifest_version="$(printf '%s\n' "$previous_manifest" \ - | sed -n 's/^version = "\([^"]*\)"/\1/p' \ - | head -n1)" - fi - - if [[ -z "$previous_manifest_version" ]]; then - echo "Previous tag $previous_tag does not include bb-cli/Cargo.toml; dispatching formula bump" - elif [[ "$manifest_version" == "$previous_manifest_version" ]]; then - should_dispatch=false - echo "bb-cli version is still $manifest_version from previous tag $previous_tag; skipping formula bump" - fi - else - echo "No previous semver tag found; dispatching formula bump" - fi - fi - - echo "formula=sq-kgoose" >> "$GITHUB_OUTPUT" - echo "formula_version=$manifest_version" >> "$GITHUB_OUTPUT" - echo "should_dispatch=$should_dispatch" >> "$GITHUB_OUTPUT" - echo "tag=$tag" >> "$GITHUB_OUTPUT" - - - name: Check Homebrew bump secrets - if: steps.vars.outputs.should_dispatch == 'true' - env: - HOMEBREW_FORMULAS_APP_ID: ${{ secrets.HOMEBREW_FORMULAS_APP_ID }} - HOMEBREW_FORMULAS_PRIVATE_KEY: ${{ secrets.HOMEBREW_FORMULAS_PRIVATE_KEY }} - run: | - set -euo pipefail - - if [[ -z "$HOMEBREW_FORMULAS_APP_ID" ]]; then - echo "HOMEBREW_FORMULAS_APP_ID is not configured for this repository" >&2 - exit 1 - fi - - if [[ -z "$HOMEBREW_FORMULAS_PRIVATE_KEY" ]]; then - echo "HOMEBREW_FORMULAS_PRIVATE_KEY is not configured for this repository" >&2 - exit 1 - fi - - - name: Generate token - if: steps.vars.outputs.should_dispatch == 'true' - uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1 - id: generate_token - with: - app-id: ${{ secrets.HOMEBREW_FORMULAS_APP_ID }} - private-key: ${{ secrets.HOMEBREW_FORMULAS_PRIVATE_KEY }} - repositories: homebrew-formulas - - - name: Dispatch formula bump - if: steps.vars.outputs.should_dispatch == 'true' - uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 - with: - token: ${{ steps.generate_token.outputs.token }} - repository: squareup/homebrew-formulas - event-type: bump_formula - client-payload: '{"repo":"${{ github.repository }}", "formula":"${{ steps.vars.outputs.formula }}", "version":"${{ steps.vars.outputs.formula_version }}", "tag":"${{ steps.vars.outputs.tag }}"}'