11name : homebrew
2- on : workflow_dispatch
2+ on :
3+ release :
4+ types : [released]
35
46jobs :
57 download-and-archive :
68 runs-on : ubuntu-latest
79 steps :
810 - name : macOS/amd64 binary
11+ if : startsWith(github.ref, 'refs/tags/')
912 run : |
10- version="v1.34.1 "
11- semvar="1.34.1 "
13+ version="${GITHUB_REF##*/} "
14+ semvar="${version:1} "
1215 curl -Lo copilot-darwin-amd64 https://github.com/aws/copilot-cli/releases/download/${version}/copilot-darwin-amd64
1316 cp copilot-darwin-amd64 copilot
1417 chmod +x copilot
1518 tar czf copilot_${semvar}_macOS_amd64.tar.gz copilot
1619 - name : macOS/arm64 binary
20+ if : startsWith(github.ref, 'refs/tags/')
1721 run : |
18- version="v1.34.1 "
19- semvar="1.34.1 "
22+ version="${GITHUB_REF##*/} "
23+ semvar="${version:1} "
2024 curl -Lo copilot-darwin-arm64 https://github.com/aws/copilot-cli/releases/download/${version}/copilot-darwin-arm64
2125 cp copilot-darwin-arm64 copilot
2226 chmod +x copilot
2327 tar czf copilot_${semvar}_macOS_arm64.tar.gz copilot
2428 - name : linux/amd64 binary
29+ if : startsWith(github.ref, 'refs/tags/')
2530 run : |
26- version="v1.34.1 "
27- semvar="1.34.1 "
31+ version="${GITHUB_REF##*/} "
32+ semvar="${version:1} "
2833 curl -Lo copilot-linux https://github.com/aws/copilot-cli/releases/download/${version}/copilot-linux
2934 cp copilot-linux copilot
3035 chmod +x copilot
3136 tar czf copilot_${semvar}_linux_amd64.tar.gz copilot
3237 - name : linux/arm64 binary
38+ if : startsWith(github.ref, 'refs/tags/')
3339 run : |
34- version="v1.34.1 "
35- semvar="1.34.1 "
40+ version="${GITHUB_REF##*/} "
41+ semvar="${version:1} "
3642 curl -Lo copilot-linux-arm64 https://github.com/aws/copilot-cli/releases/download/${version}/copilot-linux-arm64
3743 cp copilot-linux-arm64 copilot
3844 chmod +x copilot
5460 name : save tar files
5561 - name : Update release
5662 uses : softprops/action-gh-release@v1
63+ if : startsWith(github.ref, 'refs/tags/')
5764 with :
5865 files : ' *.tar.gz'
5966
@@ -75,41 +82,41 @@ jobs:
7582 path : ' homebrew-tap'
7683 - name : Update version
7784 run : |
78- version="v1.34.1 "
79- semvar="1.34.1 "
85+ version="${GITHUB_REF##*/} "
86+ semvar="${version:1} "
8087 tmp=$(mktemp)
8188 jq --arg version "${semvar}" '.version = $version' homebrew-tap/bottle-configs/copilot-cli.json > "$tmp" && mv "$tmp" homebrew-tap/bottle-configs/copilot-cli.json
8289 - name : Update root_url
8390 run : |
8491 tmp=$(mktemp)
85- version="v1.34.1 "
86- semvar="1.34.1 "
92+ version="${GITHUB_REF##*/} "
93+ semvar="${version:1} "
8794 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
8895 - name : Update sierra
8996 run : |
90- version="v1.34.1 "
91- semvar="1.34.1 "
97+ version="${GITHUB_REF##*/} "
98+ semvar="${version:1} "
9299 sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_macOS_amd64.tar.gz | awk '{print $NF}')
93100 tmp=$(mktemp)
94101 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
95102 - name : Update arm64_big_sur
96103 run : |
97- version="v1.34.1 "
98- semvar="1.34.1 "
104+ version="${GITHUB_REF##*/} "
105+ semvar="${version:1} "
99106 sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_macOS_arm64.tar.gz | awk '{print $NF}')
100107 tmp=$(mktemp)
101108 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
102109 - name : Update linux
103110 run : |
104- version="v1.34.1 "
105- semvar="1.34.1 "
111+ version="${GITHUB_REF##*/} "
112+ semvar="${version:1} "
106113 sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_linux_amd64.tar.gz | awk '{print $NF}')
107114 tmp=$(mktemp)
108115 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
109116 - name : Update linux_arm
110117 run : |
111- version="v1.34.1 "
112- semvar="1.34.1 "
118+ version="${GITHUB_REF##*/} "
119+ semvar="${version:1} "
113120 sha=$(openssl dgst -sha256 ${{steps.download.outputs.download-path}}/copilot_${semvar}_linux_arm64.tar.gz | awk '{print $NF}')
114121 tmp=$(mktemp)
115122 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
@@ -119,12 +126,12 @@ jobs:
119126 git config user.name 'ecs-cicd-bot'
120127 git config user.email 'ecs-cicd-bot@users.noreply.github.com'
121128 git add bottle-configs/copilot-cli.json
122- git commit -m "chore: upgrade copilot-cli to v1.34.1 "
129+ git commit -m "chore: upgrade copilot-cli to ${GITHUB_REF##*/} "
123130 - name : Set pull-request variables
124131 id : vars
125132 run : |
126- echo version="v1.34.1 " >> $GITHUB_OUTPUT
127- echo pr_title="chore: upgrade copilot-cli to v1.34.1 " >> $GITHUB_OUTPUT
133+ echo version="${GITHUB_REF##*/} " >> $GITHUB_OUTPUT
134+ echo pr_title="chore: upgrade copilot-cli to ${GITHUB_REF##*/} " >> $GITHUB_OUTPUT
128135 echo pr_body="Created by ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}. @aws/aws-ecs-devx" >> $GITHUB_OUTPUT
129136 - name : Create pull-request
130137 uses : peter-evans/create-pull-request@v3
0 commit comments