Skip to content

Commit

Permalink
try for a better homebrew recipe and shasum
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Nov 15, 2024
1 parent a72fdec commit 1c5e7e6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 39 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/master-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ jobs:
artifacts/*.zip
artifacts/checksums.txt
- name: Get SHA of uploaded artifact
run: |
# Get the artifact ID
ARTIFACT_ID=$(gh api /repos/${{ github.repository }}/actions/artifacts \
--jq '.artifacts[] | select(.name=="ddev-head-artifacts") | .id' \
--header "authorization: Bearer ${{ github.token }}")
# Download the artifact directly from GitHub
gh api /repos/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID/zip \
--header "authorization: Bearer ${{ github.token }}" \
-H "Accept: application/vnd.github.v3.raw" \
--output head-artifacts.zip
ls -l head-artifacts.zip && sha256sum head-artifacts.zip
echo "HEAD_ARTIFACTS_SHA=$(sha256sum head-artifacts.zip | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Show github.ref
run: echo ${{ github.ref }}

Expand Down
63 changes: 24 additions & 39 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,33 +186,26 @@ brews:
custom_block: |
head do
url "https://github.com/{{ .Env.REPOSITORY_OWNER }}/ddev.git", branch: "master"
resource "ddev-binary" do
resource "ddev-artifacts" do
url "https://nightly.link/{{ .Env.REPOSITORY_OWNER }}/ddev/workflows/master-build/master/ddev-head-artifacts.zip"
sha256 "" # We'll need to skip checksum verification for nightlies
sha256 "{{ .Env.HEAD_ARTIFACTS_SHA }}"
end
end
install: |
if build.head?
resource("ddev-binary").stage do
# First unzip the main artifact
system "unzip", "-o", "ddev-head-artifacts.zip"
resource("ddev-artifacts").unpack buildpath
# Verify checksums
system "sha256sum", "-c", "checksums.txt"
# Get the appropriate inner zipfile based on architecture
os = OS.mac? ? "darwin" : "linux"
arch = Hardware::CPU.arm? ? "arm64" : "amd64"
inner_zip = "ddev_#{os}_#{arch}.zip"
# Now get the appropriate inner zipfile based on architecture
os = OS.mac? ? "macos" : "linux"
arch = Hardware::CPU.arm? ? "arm64" : "amd64"
inner_zip = "ddev_#{os}_#{arch}.zip"
system "unzip", "-o", inner_zip, "-d", buildpath
# Unzip the architecture-specific binary and completions
system "unzip", "-o", inner_zip
bin.install "ddev"
bash_completion.install "ddev_bash_completion.sh" => "ddev"
zsh_completion.install "ddev_zsh_completion.sh" => "_ddev"
fish_completion.install "ddev_fish_completion.sh" => "ddev.fish"
end
bin.install "ddev"
bash_completion.install "ddev_bash_completion.sh" => "ddev"
zsh_completion.install "ddev_zsh_completion.sh" => "_ddev"
fish_completion.install "ddev_fish_completion.sh" => "ddev.fish"
else
bin.install "ddev"
bash_completion.install "ddev_bash_completion.sh" => "ddev"
Expand Down Expand Up @@ -241,34 +234,26 @@ brews:
custom_block: |
head do
url "https://github.com/{{ .Env.REPOSITORY_OWNER }}/ddev.git", branch: "master"
resource "ddev-binary" do
resource "ddev-artifacts" do
url "https://nightly.link/{{ .Env.REPOSITORY_OWNER }}/ddev/workflows/master-build/master/ddev-head-artifacts.zip"
sha256 "" # We'll need to skip checksum verification for nightlies
sha256 "{{ .Env.HEAD_ARTIFACTS_SHA }}"
end
end
install: |
if build.head?
resource("ddev-binary").stage do
# First unzip the main artifact
system "unzip", "-o", "ddev-head-artifacts.zip"
resource("ddev-artifacts").unpack buildpath
# Verify checksums
system "sha256sum", "-c", "checksums.txt"
# Get the appropriate inner zipfile based on architecture
os = OS.mac? ? "darwin" : "linux"
arch = Hardware::CPU.arm? ? "arm64" : "amd64"
inner_zip = "ddev_#{os}_#{arch}.zip"
# Now get the appropriate inner zipfile based on architecture
os = OS.mac? ? "macos" : "linux"
arch = Hardware::CPU.arm? ? "arm64" : "amd64"
inner_zip = "ddev_#{os}_#{arch}.zip"
system "unzip", "-o", inner_zip, "-d", buildpath
# Unzip the architecture-specific binary and completions
system "unzip", "-o", inner_zip
bin.install "ddev"
bash_completion.install "ddev_bash_completion.sh" => "ddev"
zsh_completion.install "ddev_zsh_completion.sh" => "_ddev"
fish_completion.install "ddev_fish_completion.sh" => "ddev.fish"
end
bin.install "ddev"
bash_completion.install "ddev_bash_completion.sh" => "ddev"
zsh_completion.install "ddev_zsh_completion.sh" => "_ddev"
fish_completion.install "ddev_fish_completion.sh" => "ddev.fish"
else
bin.install "ddev"
bash_completion.install "ddev_bash_completion.sh" => "ddev"
Expand Down

0 comments on commit 1c5e7e6

Please sign in to comment.