Skip to content

Commit

Permalink
build: fix homebrew gh action using version without "v" prefix (#2893)
Browse files Browse the repository at this point in the history
Tested this in personal repo and it generated a PR with the correct formatting now: efekarakus/copilot-pipeline-test#8

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
  • Loading branch information
efekarakus authored Oct 4, 2021
1 parent 8b089d3 commit 459f729
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions .github/workflows/homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,39 @@ jobs:
- name: macOS/amd64 binary
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -Lo copilot-darwin-amd64 https://github.com/aws/copilot-cli/releases/download/${GITHUB_REF##*/}/copilot-darwin-amd64
version="${GITHUB_REF##*/}"
semvar="${version:1}"
curl -Lo copilot-darwin-amd64 https://github.com/aws/copilot-cli/releases/download/${version}/copilot-darwin-amd64
cp copilot-darwin-amd64 copilot
chmod +x copilot
tar czf copilot_${GITHUB_REF##*/}_macOS_amd64.tar.gz copilot
tar czf copilot_${semvar}_macOS_amd64.tar.gz copilot
- name: macOS/arm64 binary
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -Lo copilot-darwin-arm64 https://github.com/aws/copilot-cli/releases/download/${GITHUB_REF##*/}/copilot-darwin-arm64
version="${GITHUB_REF##*/}"
semvar="${version:1}"
curl -Lo copilot-darwin-arm64 https://github.com/aws/copilot-cli/releases/download/${version}/copilot-darwin-arm64
cp copilot-darwin-arm64 copilot
chmod +x copilot
tar czf copilot_${GITHUB_REF##*/}_macOS_arm64.tar.gz copilot
tar czf copilot_${semvar}_macOS_arm64.tar.gz copilot
- name: linux/amd64 binary
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -Lo copilot-linux https://github.com/aws/copilot-cli/releases/download/${GITHUB_REF##*/}/copilot-linux
version="${GITHUB_REF##*/}"
semvar="${version:1}"
curl -Lo copilot-linux https://github.com/aws/copilot-cli/releases/download/${version}/copilot-linux
cp copilot-linux copilot
chmod +x copilot
tar czf copilot_${GITHUB_REF##*/}_linux_amd64.tar.gz copilot
tar czf copilot_${semvar}_linux_amd64.tar.gz copilot
- name: linux/arm64 binary
if: startsWith(github.ref, 'refs/tags/')
run: |
curl -Lo copilot-linux-arm64 https://github.com/aws/copilot-cli/releases/download/${GITHUB_REF##*/}/copilot-linux-arm64
version="${GITHUB_REF##*/}"
semvar="${version:1}"
curl -Lo copilot-linux-arm64 https://github.com/aws/copilot-cli/releases/download/${version}/copilot-linux-arm64
cp copilot-linux-arm64 copilot
chmod +x copilot
tar czf copilot_${GITHUB_REF##*/}_linux_arm64.tar.gz copilot
tar czf copilot_${semvar}_linux_arm64.tar.gz copilot
- name: Save archive files
uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -74,8 +82,10 @@ jobs:
path: 'homebrew-tap'
- name: Update version
run: |
version="${GITHUB_REF##*/}"
semvar="${version:1}"
tmp=$(mktemp)
jq --arg version "${GITHUB_REF##*/}" '.version = $version' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
jq --arg version "${semvar}" '.version = $version' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
- name: Update root_url
run: |
tmp=$(mktemp)
Expand All @@ -84,22 +94,30 @@ jobs:
jq --arg version "${version}" --arg semvar "${semvar}" '.bottle.root_url = "https://github.com/aws/copilot-cli/releases/download/" + $version + "/copilot_" + $semvar + "_"' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
- name: Update sierra
run: |
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${GITHUB_REF##*/}_macOS_amd64.tar.gz | awk '{print $NF}')
version="${GITHUB_REF##*/}"
semvar="${version:1}"
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_macOS_amd64.tar.gz | awk '{print $NF}')
tmp=$(mktemp)
jq --arg sha "$sha" '.bottle.sha256.sierra = "'$sha'"' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
- name: Update arm64_big_sur
run: |
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${GITHUB_REF##*/}_macOS_arm64.tar.gz | awk '{print $NF}')
version="${GITHUB_REF##*/}"
semvar="${version:1}"
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_macOS_arm64.tar.gz | awk '{print $NF}')
tmp=$(mktemp)
jq --arg sha "$sha" '.bottle.sha256.arm64_big_sur = "'$sha'"' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
- name: Update linux
run: |
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${GITHUB_REF##*/}_linux_amd64.tar.gz | awk '{print $NF}')
version="${GITHUB_REF##*/}"
semvar="${version:1}"
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_linux_amd64.tar.gz | awk '{print $NF}')
tmp=$(mktemp)
jq --arg sha "$sha" '.bottle.sha256.linux = "'$sha'"' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
- name: Update linux_arm
run: |
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${GITHUB_REF##*/}_linux_arm64.tar.gz | awk '{print $NF}')
version="${GITHUB_REF##*/}"
semvar="${version:1}"
sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_linux_arm64.tar.gz | awk '{print $NF}')
tmp=$(mktemp)
jq --arg sha "$sha" '.bottle.sha256.linux_arm = "'$sha'"' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
- name: Create commits
Expand Down

0 comments on commit 459f729

Please sign in to comment.