UpdateCliFormula #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update CLI Formula | |
on: | |
repository_dispatch: | |
types: UpdateCliFormula | |
jobs: | |
update_formula: | |
name: Update CLI Formula to ${{ github.event.client_payload.version }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v3 | |
- name: copy template into formula | |
run: cp armory-cli_formula_template.txt ./Formula/armory-cli.rb | |
- name: replace version number | |
run: perl -i -pe"s/#VERSION/${{ github.event.client_payload.version }}/g" ./Formula/armory-cli.rb | |
- name: construct base URL | |
id: constructBaseUrl | |
run: | | |
echo "baseUrl='https://armory-cli-releases.s3.amazonaws.com/cli/v${{ github.event.client_payload.version }}/armory'" >> $GITHUB_OUTPUT | |
- name: compute Shas | |
id: computeShas | |
run: | | |
echo "darwinAmd64Sha=$(curl -Ls ${{ steps.constructBaseUrl.outputs.baseUrl }}-darwin-amd64 | shasum -a 256 | head -c 64)" >> $GITHUB_OUTPUT | |
echo "darwinArm64Sha=$(curl -Ls ${{ steps.constructBaseUrl.outputs.baseUrl }}-darwin-arm64 | shasum -a 256 | head -c 64)" >> $GITHUB_OUTPUT | |
echo "linuxAmd64Sha=$(curl -Ls ${{ steps.constructBaseUrl.outputs.baseUrl }}-linux-amd64 | shasum -a 256 | head -c 64)" >> $GITHUB_OUTPUT | |
echo "linuxArm64Sha=$(curl -Ls ${{ steps.constructBaseUrl.outputs.baseUrl }}-linux-arm64 | shasum -a 256 | head -c 64)" >> $GITHUB_OUTPUT | |
- name: replace shas in formula | |
run: | | |
perl -i -pe"s/#darwin-amd64-sha/${{ steps.computeShas.outputs.darwinAmd64Sha }}/g" ./Formula/armory-cli.rb | |
perl -i -pe"s/#darwin-arm64-sha/${{ steps.computeShas.outputs.darwinArm64Sha }}/g" ./Formula/armory-cli.rb | |
perl -i -pe"s/#linux-amd64-sha/${{ steps.computeShas.outputs.linuxAmd64Sha }}/g" ./Formula/armory-cli.rb | |
perl -i -pe"s/#linux-arm64-sha/${{ steps.computeShas.outputs.linuxArm64Sha }}/g" ./Formula/armory-cli.rb | |
- name: print changed formula | |
run: cat ./Formula/armory-cli.rb | |
- name: commit formula | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update CLI Formula to ${{ github.event.client_payload.version }} | |
branch: main |