Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle mismatched formula names in brew publish #816

Merged
merged 3 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo-dist-schema/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cargo-dist-schema"
description = "Schema information for cargo-dist's dist-manifest.json"
version = "0.11.0"
version = "0.11.1-prerelease.1"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/axodotdev/cargo-dist"
Expand Down
4 changes: 2 additions & 2 deletions cargo-dist/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cargo-dist"
description = "Shippable application packaging for Rust"
version = "0.11.0"
version = "0.11.1-prerelease.1"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/axodotdev/cargo-dist"
Expand Down Expand Up @@ -34,7 +34,7 @@ axocli = { version = "0.2.0", optional = true }

# Features used by the cli and library
axotag = "0.1.0"
cargo-dist-schema = { version = "=0.11.0", path = "../cargo-dist-schema" }
cargo-dist-schema = { version = "=0.11.1-prerelease.1", path = "../cargo-dist-schema" }

axoasset = { version = "0.7.0", features = ["json-serde", "toml-serde", "toml-edit", "compression"] }
axoprocess = { version = "0.2.0" }
Expand Down
9 changes: 6 additions & 3 deletions cargo-dist/templates/ci/github_ci.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -487,16 +487,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down
11 changes: 6 additions & 5 deletions cargo-dist/tests/snapshots/akaikatana_basic.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1718,16 +1718,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down Expand Up @@ -1767,5 +1770,3 @@ jobs:
body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
artifacts: "artifacts/*"


11 changes: 6 additions & 5 deletions cargo-dist/tests/snapshots/akaikatana_repo_with_dot_git.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1718,16 +1718,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down Expand Up @@ -1767,5 +1770,3 @@ jobs:
body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
artifacts: "artifacts/*"


11 changes: 6 additions & 5 deletions cargo-dist/tests/snapshots/axolotlsay_basic.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2634,16 +2634,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down Expand Up @@ -2913,5 +2916,3 @@ jobs:
</Product>

</Wix>


9 changes: 6 additions & 3 deletions cargo-dist/tests/snapshots/axolotlsay_custom_formula.snap
Original file line number Diff line number Diff line change
Expand Up @@ -575,16 +575,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down
11 changes: 6 additions & 5 deletions cargo-dist/tests/snapshots/axolotlsay_edit_existing.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2609,16 +2609,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down Expand Up @@ -2660,5 +2663,3 @@ jobs:
omitNameDuringUpdate: true
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
artifacts: "artifacts/*"


Original file line number Diff line number Diff line change
Expand Up @@ -2629,16 +2629,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down
9 changes: 6 additions & 3 deletions cargo-dist/tests/snapshots/axolotlsay_user_host_job.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2631,16 +2631,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2629,16 +2629,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down
9 changes: 6 additions & 3 deletions cargo-dist/tests/snapshots/axolotlsay_user_plan_job.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2619,16 +2619,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down
11 changes: 6 additions & 5 deletions cargo-dist/tests/snapshots/axolotlsay_user_publish_job.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2609,16 +2609,19 @@ jobs:
pattern: artifacts-*
path: Formula/
merge-multiple: true
# This is extra complex because you can make your Formula name not match your app name
# so we need to find releases with a *.rb file, and publish with that filename.
- name: Commit formula files
run: |
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_EMAIL}"

for release in $(echo "$PLAN" | jq --compact-output '.releases[]'); do
name=$(echo "$release" | jq .app_name --raw-output)
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
name=$(echo "$filename" | sed "s/\.rb$//")
version=$(echo "$release" | jq .app_version --raw-output)

git add Formula/${name}.rb
git add "Formula/${filename}"
git commit -m "${name} ${version}"
done
git push
Expand Down Expand Up @@ -2688,5 +2691,3 @@ jobs:
body: ${{ fromJson(needs.host.outputs.val).announcement_github_body }}
prerelease: ${{ fromJson(needs.host.outputs.val).announcement_is_prerelease }}
artifacts: "artifacts/*"