execute-release #46
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: Execute Release | |
on: | |
repository_dispatch: | |
types: | |
- execute-release | |
env: | |
CARGO_TERM_COLOR: always | |
APP_NAME: 'momento-cli' | |
MAINTAINER: 'momentohq' | |
DESC: 'Official CLI for Momento Serverless Cache' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.release.outputs.release }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: semrel release | |
id: semrel | |
uses: go-semantic-release/action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
allow-initial-development-versions: true | |
force-bump-patch-version: true | |
# For whatever reason, this silly tool won't let you do releases from branches | |
# other than the default branch unless you pass this flag, which doesn't seem | |
# to actually have anything to do with CI: | |
# https://github.com/go-semantic-release/semantic-release/blob/master/cmd/semantic-release/main.go#L173-L194 | |
# https://github.com/go-semantic-release/condition-github/blob/4c8af3fc516151423fff2f77eb08bf7082570676/pkg/condition/github.go#L42-L44 | |
custom-arguments: "--no-ci" | |
- name: Build tar.gz | |
run: | | |
STASH_SHA=$(git stash create) | |
VERSION=${{ steps.semrel.outputs.version }} | |
ARCHIVE_FILE=archive-$VERSION.tar.gz | |
echo "ARCHIVE_FILE="$ARCHIVE_FILE >> $GITHUB_ENV | |
pip install git-archive-all | |
git-archive-all $ARCHIVE_FILE | |
SHA=$(openssl sha256 < ${ARCHIVE_FILE} | sed 's/.* //') | |
echo "SHA="$SHA >> $GITHUB_ENV | |
echo "sha is: ${SHA}" | |
AUTH="Authorization: token ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}" | |
LATEST_RELEASE=$(curl -sH "$AUTH" https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/v${VERSION}) | |
RELEASE_ID=$(echo $LATEST_RELEASE | jq -r .id) | |
GH_ASSET="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${ARCHIVE_FILE}" | |
echo $GH_ASSET | |
curl --data-binary @$ARCHIVE_FILE -H "$AUTH" -H "Content-Type: application/octet-stream" $GH_ASSET | |
shell: bash | |
- name: Output release | |
id: release | |
run: echo "::set-output name=release::${{ steps.semrel.outputs.version }}" | |
publish-linux-assets: | |
runs-on: ubuntu-latest | |
needs: [ release ] | |
strategy: | |
matrix: | |
architecture: | |
- { target: aarch64-unknown-linux-gnu, rpm-arch-shortname: aarch64, deb-arch-shortname: arm64, os: ubuntu-20.04, use-cross: true } | |
- { target: x86_64-unknown-linux-gnu, rpm-arch-shortname: x86_64, deb-arch-shortname: amd64, os: ubuntu-20.04, use-cross: true } | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install protoc | |
run: ./scripts/install_protoc_linux.sh | |
- name: Install prerequisites | |
shell: bash | |
run: | | |
case ${{ matrix.architecture.target }} in | |
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; | |
esac | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.architecture.target }} | |
override: true | |
profile: minimal # minimal component installation (ie, no documentation) | |
- name: Show version information (Rust, cargo, GCC) | |
shell: bash | |
run: | | |
gcc --version || true | |
rustup -V | |
rustup toolchain list | |
rustup default | |
cargo -V | |
rustc -V | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.architecture.use-cross }} | |
command: build | |
args: --locked --release --target=${{ matrix.architecture.target }} | |
- name: Inspect Build | |
run: | | |
ls target | |
ls target/release | |
shell: bash | |
- name: Build tar.gz and publish asset | |
run: | | |
VERSION=${{ needs.release.outputs.version }} | |
ARCHIVE_FILE="momento-cli-$VERSION.linux_${{ matrix.architecture.rpm-arch-shortname }}.tar.gz" | |
BUILD_OUTPUT_DIR="./target/${{ matrix.architecture.target }}/release/" | |
mkdir $BUILD_OUTPUT_DIR/bash | |
cp $BUILD_OUTPUT_DIR/momento.bash $BUILD_OUTPUT_DIR/bash/momento | |
mkdir $BUILD_OUTPUT_DIR/zsh | |
cp $BUILD_OUTPUT_DIR/_momento $BUILD_OUTPUT_DIR/zsh/_momento | |
tar -C ./target/${{ matrix.architecture.target }}/release/ -zcvf $ARCHIVE_FILE momento bash/ zsh/ | |
AUTH="Authorization: token ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}" | |
LATEST_RELEASE=$(curl -sH "$AUTH" https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/v${VERSION}) | |
RELEASE_ID=$(echo $LATEST_RELEASE | jq -r .id) | |
GH_ASSET="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${ARCHIVE_FILE}" | |
echo $GH_ASSET | |
curl --data-binary @$ARCHIVE_FILE -H "$AUTH" -H "Content-Type: application/octet-stream" $GH_ASSET | |
shell: bash | |
- name: Install nfpm to build rpm and deb | |
run: | | |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list | |
sudo apt update | |
sudo apt install nfpm | |
shell: bash | |
- name: Update nfpm package config for rpms | |
run: | | |
export MOMENTO_VERSION=${{ needs.release.outputs.version }} | |
export MOMENTO_ARCH=${{ matrix.architecture.rpm-arch-shortname }} | |
export BUILD_OUTPUT_DIR=./target/${{ matrix.architecture.target }}/release | |
export MOMENTO_BINARY=$BUILD_OUTPUT_DIR/momento | |
export MOMENTO_BASH_COMPLETION=$BUILD_OUTPUT_DIR/bash/momento | |
export MOMENTO_ZSH_COMPLETION=$BUILD_OUTPUT_DIR/zsh/_momento | |
cat nfpm.template.yaml |envsubst \$MOMENTO_VERSION |envsubst \$MOMENTO_ARCH |envsubst \$MOMENTO_BINARY |envsubst \$MOMENTO_BASH_COMPLETION |envsubst \$MOMENTO_ZSH_COMPLETION > nfpm.yaml | |
cat nfpm.yaml | |
shell: bash | |
- name: Build and publish rpm via nfpm | |
run: | | |
nfpm pkg --packager rpm | |
VERSION=${{ needs.release.outputs.version }} | |
BINARY_FILE="${{ env.APP_NAME }}-$VERSION.${{ matrix.architecture.rpm-arch-shortname }}.rpm" | |
AUTH="Authorization: token ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}" | |
LATEST_RELEASE=$(curl -sH "$AUTH" https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/v${VERSION}) | |
RELEASE_ID=$(echo $LATEST_RELEASE | jq -r .id) | |
GH_ASSET="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${BINARY_FILE}" | |
echo $GH_ASSET | |
curl --data-binary @$BINARY_FILE -H "$AUTH" -H "Content-Type: application/octet-stream" $GH_ASSET | |
- name: Update nfpm package config for debs | |
run: | | |
export MOMENTO_VERSION=${{ needs.release.outputs.version }} | |
export MOMENTO_ARCH=${{ matrix.architecture.deb-arch-shortname }} | |
export BUILD_OUTPUT_DIR=./target/${{ matrix.architecture.target }}/release | |
export MOMENTO_BINARY=$BUILD_OUTPUT_DIR/momento | |
export MOMENTO_BASH_COMPLETION=$BUILD_OUTPUT_DIR/bash/momento | |
export MOMENTO_ZSH_COMPLETION=$BUILD_OUTPUT_DIR/zsh/_momento | |
cat nfpm.template.yaml |envsubst \$MOMENTO_VERSION |envsubst \$MOMENTO_ARCH |envsubst \$MOMENTO_BINARY |envsubst \$MOMENTO_BASH_COMPLETION |envsubst \$MOMENTO_ZSH_COMPLETION > nfpm.yaml | |
cat nfpm.yaml | |
shell: bash | |
- name: Build and publish deb via nfpm | |
run: | | |
nfpm pkg --packager deb | |
VERSION=${{ needs.release.outputs.version }} | |
BINARY_FILE="${{ env.APP_NAME }}_${VERSION}_${{ matrix.architecture.deb-arch-shortname }}.deb" | |
AUTH="Authorization: token ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}" | |
LATEST_RELEASE=$(curl -sH "$AUTH" https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/v${VERSION}) | |
RELEASE_ID=$(echo $LATEST_RELEASE | jq -r .id) | |
GH_ASSET="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${BINARY_FILE}" | |
echo $GH_ASSET | |
curl --data-binary @$BINARY_FILE -H "$AUTH" -H "Content-Type: application/octet-stream" $GH_ASSET | |
publish-mac-assets: | |
runs-on: macos-latest | |
needs: [ release ] | |
strategy: | |
matrix: | |
architecture: | |
- { target: x86_64-apple-darwin, use-cross: false } | |
- { target: aarch64-apple-darwin, use-cross: true } | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install protoc | |
run: ./scripts/install_protoc_osx.sh | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.architecture.target }} | |
override: true | |
profile: minimal # minimal component installation (ie, no documentation) | |
- name: Show version information (Rust, cargo, GCC) | |
shell: bash | |
run: | | |
gcc --version || true | |
rustup -V | |
rustup toolchain list | |
rustup default | |
cargo -V | |
rustc -V | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.architecture.use-cross }} | |
command: build | |
args: --locked --release --target=${{ matrix.architecture.target }} | |
- name: Inspect Build | |
run: | | |
ls target | |
ls target/release | |
shell: bash | |
- name: Build tar.gz and publish asset | |
run: | | |
VERSION=${{ needs.release.outputs.version }} | |
ARCHIVE_FILE="momento-cli-$VERSION.${{ matrix.architecture.target }}.tar.gz" | |
BUILD_OUTPUT_DIR="./target/${{ matrix.architecture.target }}/release/" | |
mkdir $BUILD_OUTPUT_DIR/bash | |
cp $BUILD_OUTPUT_DIR/momento.bash $BUILD_OUTPUT_DIR/bash/momento | |
mkdir $BUILD_OUTPUT_DIR/zsh | |
cp $BUILD_OUTPUT_DIR/_momento $BUILD_OUTPUT_DIR/zsh/_momento | |
tar -C $BUILD_OUTPUT_DIR -zcvf $ARCHIVE_FILE momento bash/ zsh/ | |
AUTH="Authorization: token ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}" | |
LATEST_RELEASE=$(curl -sH "$AUTH" https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/v${VERSION}) | |
RELEASE_ID=$(echo $LATEST_RELEASE | jq -r .id) | |
GH_ASSET="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${ARCHIVE_FILE}" | |
echo $GH_ASSET | |
curl --data-binary @$ARCHIVE_FILE -H "$AUTH" -H "Content-Type: application/octet-stream" $GH_ASSET | |
shell: bash | |
publish-windows-assets: | |
runs-on: windows-latest | |
needs: [release] | |
outputs: | |
msi_filename: ${{ steps.build_installer.outputs.asset_name }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install protoc | |
run: choco install protoc | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
override: true | |
- name: Show Cargo Version | |
run: | | |
cat Cargo.toml | |
shell: bash | |
- name: Build | |
id: build | |
env: | |
VERSION: ${{ needs.release.outputs.version }} | |
run: | | |
rustup target add x86_64-pc-windows-gnu | |
cargo build --release --target x86_64-pc-windows-gnu | |
echo "::set-output name=momento_binary_path::.\target\x86_64-pc-windows-gnu\release\momento.exe" | |
$distributableFile64Prefix = "momento-cli-$env:VERSION.windows_x64" | |
echo "::set-output name=distributable_file_prefix::$distributableFile64Prefix" | |
- name: Write PFX certificate file | |
id: write_pfx | |
env: | |
PFX_CONTENT: ${{ secrets.CODE_SIGNING_CERT_BASE64 }} | |
run: | | |
$pfxPath = "cert.pfx"; | |
$encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); | |
Set-Content $pfxPath -Value $encodedBytes -AsByteStream; | |
echo "::set-output name=pfx_path::$pfxPath"; | |
- name: Test and cache signtool path | |
id: signtool | |
run: | | |
$signtool = "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" | |
Test-Path -Path $signtool -PathType Leaf | |
echo "::set-output name=signtool_path::$signtool" | |
- name: Sign Momento binary | |
env: | |
SIGNTOOL_PATH: ${{ steps.signtool.outputs.signtool_path }} | |
CERT_PATH: ${{ steps.write_pfx.outputs.pfx_path }} | |
CERT_PASSWORD: ${{ secrets.CODE_SIGNING_CERT_PASSWORD }} | |
MOMENTO_BINARY_PATH: ${{ steps.build.outputs.momento_binary_path }} | |
run: | | |
& $env:SIGNTOOL_PATH sign /fd SHA256 /a /f $env:CERT_PATH /p $env:CERT_PASSWORD /tr http://timestamp.digicert.com /td SHA256 $env:MOMENTO_BINARY_PATH | |
- name: Create zip | |
id: create_zip | |
env: | |
MOMENTO_BINARY_PATH: ${{ steps.build.outputs.momento_binary_path }} | |
DISTRIBUTABLE_FILE_PREFIX: ${{ steps.build.outputs.distributable_file_prefix }} | |
run: | | |
$zipFilename = "$env:DISTRIBUTABLE_FILE_PREFIX.zip" | |
$zipPath = ".\$zipFilename" | |
Compress-Archive -LiteralPath $env:MOMENTO_BINARY_PATH -DestinationPath $zipPath | |
echo "::set-output name=asset_path::$zipPath" | |
echo "::set-output name=asset_name::$zipFilename" | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v1.1 | |
- name: Build installer | |
id: build_installer | |
env: | |
MOMENTO_BINARY_PATH: ${{ steps.build.outputs.momento_binary_path }} | |
DISTRIBUTABLE_FILE_PREFIX: ${{ steps.build.outputs.distributable_file_prefix }} | |
VERSION: ${{ needs.release.outputs.version }} | |
run: | | |
cp $env:MOMENTO_BINARY_PATH .\windows\installer | |
$env:BuildVersion = "$env:VERSION" | |
msbuild .\windows\installer\MomentoCLI.wixproj /p:Configuration=Release /p:OutputName=$env:DISTRIBUTABLE_FILE_PREFIX | |
$msiFilename = "$env:DISTRIBUTABLE_FILE_PREFIX.msi" | |
$msiPath = ".\windows\installer\bin\Release\$msiFilename" | |
echo "::set-output name=asset_path::$msiPath" | |
echo "::set-output name=asset_name::$msiFilename" | |
- name: Sign installer | |
env: | |
SIGNTOOL_PATH: ${{ steps.signtool.outputs.signtool_path }} | |
CERT_PATH: ${{ steps.write_pfx.outputs.pfx_path }} | |
CERT_PASSWORD: ${{ secrets.CODE_SIGNING_CERT_PASSWORD }} | |
MSI_PATH: ${{ steps.build_installer.outputs.asset_path }} | |
run: | | |
& $env:SIGNTOOL_PATH sign /fd SHA256 /a /f $env:CERT_PATH /p $env:CERT_PASSWORD /tr http://timestamp.digicert.com /td SHA256 $env:MSI_PATH | |
- name: Delete PFX certificate | |
env: | |
CERT_PATH: ${{ steps.write_pfx.outputs.pfx_path }} | |
run: Remove-Item -Path $env:CERT_PATH | |
- name: Create zip and installer urls | |
id: create_release_urls | |
env: | |
VERSION: ${{ needs.release.outputs.version }} | |
ZIP_FILENAME: ${{ steps.create_zip.outputs.asset_name }} | |
MSI_FILENAME: ${{ steps.build_installer.outputs.asset_name }} | |
run: | | |
$latestReleaseUri = "https://api.github.com/repos/momentohq/momento-cli/releases/tags/v$env:VERSION" | |
$latestRelease = (Invoke-WebRequest -Uri $latestReleaseUri -Method Get -Headers @{'authorization' = 'Bearer ${{ secrets.GITHUB_TOKEN }}' } | Select-Object -Property Content).Content | |
$releaseId = $latestRelease | jq -r .id | |
$ghAssetMsi = "https://uploads.github.com/repos/momentohq/momento-cli/releases/$releaseId/assets?name=$env:MSI_FILENAME" | |
$ghAssetZip = "https://uploads.github.com/repos/momentohq/momento-cli/releases/$releaseId/assets?name=$env:ZIP_FILENAME" | |
echo "::set-output name=upload_url_msi::$ghAssetMsi" | |
echo "::set-output name=upload_url_zip::$ghAssetZip" | |
- name: Upload windows_x64 msi | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release_urls.outputs.upload_url_msi }} | |
asset_path: ${{ steps.build_installer.outputs.asset_path }} | |
asset_name: ${{ steps.build_installer.outputs.asset_name }} | |
asset_content_type: application/octet-stream | |
- name: Upload windows_x64 zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release_urls.outputs.upload_url_zip }} | |
asset_path: ${{ steps.create_zip.outputs.asset_path }} | |
asset_name: ${{ steps.create_zip.outputs.asset_name }} | |
asset_content_type: application/zip | |
# Commenting out building i686 since the machine doesn't seem to have i686-w64-mingw32-gcc.exe compiler installed by default. | |
# Come back and work on this when customers ask 32-bit build. | |
# | |
# - name: Add mingw32 to path | |
# shell: bash | |
# run: | | |
# echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH | |
# - name: Build zip for windows_i686 and create release | |
# id: create_release_32 | |
# run: | | |
# $env:Version = "${{ needs.release.outputs.version }}" | |
# $env:BinaryFile32 = "momento-cli-" + $env:VERSION + ".windows_i686.zip" | |
# rustup target add i686-pc-windows-gnu | |
# cargo build --release --target i686-pc-windows-gnu | |
# $env:CurrentDir = Get-Location | |
# $env:LiteralPath = $env:CurrentDir + "\target\i686-pc-windows-gnu\release\momento.exe" | |
# $env:DestinationPath = $env:CurrentDir + "\" + $env:BinaryFile32 | |
# Compress-Archive -LiteralPath $env:LiteralPath -DestinationPath $env:DestinationPath | |
# $env:LatestReleaseUri = "https://api.github.com/repos/momentohq/momento-cli/releases/tags/v" + $env:Version | |
# $env:LatestReleaseUri | |
# $env:LatestRelease = (Invoke-WebRequest -Uri $env:LatestReleaseUri -Method Get | Select-Object -Property Content).Content | |
# $env:ReleaseId = $env:LatestRelease | jq -r .id | |
# $GhAsset32 = "https://uploads.github.com/repos/momentohq/momento-cli/releases/" + $env:ReleaseId + "/assets?name=" + $env:BinaryFile32 | |
# $GhAsset32 | |
# echo "::set-output name=upload_url::$GhAsset32" | |
# echo "::set-output name=asset_path::$env:DestinationPath" | |
# echo "::set-output name=asset_name::$env:BinaryFile32" | |
# - name: Upload windows_i686 zip | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release_32.outputs.upload_url }} | |
# asset_path: ${{ steps.create_release_32.outputs.asset_path }} | |
# asset_name: ${{ steps.create_release_32.outputs.asset_name }} | |
# asset_content_type: application/zip | |
update-winget-package-manager: | |
runs-on: windows-latest | |
needs: [ release, publish-windows-assets ] | |
steps: | |
- name: Download winget | |
run: iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe | |
- name: Build installer URL | |
id: build_installer_url | |
env: | |
VERSION: ${{ needs.release.outputs.version }} | |
MSI_FILENAME: ${{ needs.publish-windows-assets.outputs.msi_filename }} | |
run: | | |
$installerUrl = "https://github.com/momentohq/momento-cli/releases/download/v$env:VERSION/$env:MSI_FILENAME" | |
echo "::set-output name=installer_url::$installerUrl" | |
- name: Open PR on WinGet | |
env: | |
INSTALLER_URL: ${{ steps.build_installer_url.outputs.installer_url }} | |
VERSION: ${{ needs.release.outputs.version }} | |
GITHUB_TOKEN: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }} | |
run: .\wingetcreate.exe update momento.cli -s -v $env:VERSION -u $env:INSTALLER_URL -t $env:GITHUB_TOKEN | |
update-homebrew-formula: | |
runs-on: ubuntu-latest | |
needs: [ release, publish-linux-assets, publish-mac-assets ] | |
steps: | |
- name: Check out homebrew-tap | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
repository: momentohq/homebrew-tap | |
token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }} | |
- name: update homebrew formulae | |
run: | | |
export MOMENTO_CLI_VERSION=${{ needs.release.outputs.version }} | |
echo "Version is $MOMENTO_CLI_VERSION" | |
git checkout -b formula/momento-cli/v${MOMENTO_CLI_VERSION} | |
export MOMENTO_CLI_LINUX_X86_64_URL="https://github.com/momentohq/momento-cli/releases/download/v${MOMENTO_CLI_VERSION}/momento-cli-${MOMENTO_CLI_VERSION}.linux_x86_64.tar.gz" | |
export MOMENTO_CLI_LINUX_AARCH64_URL="https://github.com/momentohq/momento-cli/releases/download/v${MOMENTO_CLI_VERSION}/momento-cli-${MOMENTO_CLI_VERSION}.linux_aarch64.tar.gz" | |
export MOMENTO_CLI_MAC_X86_64_URL="https://github.com/momentohq/momento-cli/releases/download/v${MOMENTO_CLI_VERSION}/momento-cli-${MOMENTO_CLI_VERSION}.x86_64-apple-darwin.tar.gz" | |
export MOMENTO_CLI_MAC_AARCH64_URL="https://github.com/momentohq/momento-cli/releases/download/v${MOMENTO_CLI_VERSION}/momento-cli-${MOMENTO_CLI_VERSION}.aarch64-apple-darwin.tar.gz" | |
echo "Downloading and computing SHA for ${MOMENTO_CLI_LINUX_X86_64_URL}" | |
wget ${MOMENTO_CLI_LINUX_X86_64_URL} -O linux-x86_64.tgz | |
export MOMENTO_CLI_LINUX_X86_64_SHA=$(shasum -a 256 linux-x86_64.tgz | awk '{print $1}') | |
rm linux-x86_64.tgz | |
echo "Downloading and computing SHA for ${MOMENTO_CLI_LINUX_AARCH64_URL}" | |
wget ${MOMENTO_CLI_LINUX_AARCH64_URL} -O linux-aarch64.tgz | |
export MOMENTO_CLI_LINUX_AARCH64_SHA=$(shasum -a 256 linux-aarch64.tgz | awk '{print $1}') | |
rm linux-aarch64.tgz | |
echo "Downloading and computing SHA for ${MOMENTO_CLI_MAC_X86_64_URL}" | |
wget ${MOMENTO_CLI_MAC_X86_64_URL} -O mac-x86_64.tgz | |
export MOMENTO_CLI_MAC_X86_64_SHA=$(shasum -a 256 mac-x86_64.tgz | awk '{print $1}') | |
rm mac-x86_64.tgz | |
echo "Downloading and computing SHA for ${MOMENTO_CLI_MAC_AARCH64_URL}" | |
wget ${MOMENTO_CLI_MAC_AARCH64_URL} -O mac-aarch64.tgz | |
export MOMENTO_CLI_MAC_AARCH64_SHA=$(shasum -a 256 mac-aarch64.tgz | awk '{print $1}') | |
rm mac-aarch64.tgz | |
pushd Formula | |
cat momento-cli.rb.template \ | |
| envsubst \$MOMENTO_CLI_VERSION \ | |
| envsubst \$MOMENTO_CLI_LINUX_X86_64_URL \ | |
| envsubst \$MOMENTO_CLI_LINUX_X86_64_SHA \ | |
| envsubst \$MOMENTO_CLI_LINUX_AARCH64_URL \ | |
| envsubst \$MOMENTO_CLI_LINUX_AARCH64_SHA \ | |
| envsubst \$MOMENTO_CLI_MAC_X86_64_URL \ | |
| envsubst \$MOMENTO_CLI_MAC_X86_64_SHA \ | |
| envsubst \$MOMENTO_CLI_MAC_AARCH64_URL \ | |
| envsubst \$MOMENTO_CLI_MAC_AARCH64_SHA \ | |
> momento-cli.rb | |
cat momento-cli.rb | |
popd | |
git config user.email "momentobot@users.noreply.github.com" | |
git config user.name "momentobot" | |
git add . | |
git commit -m "momento-cli ${MOMENTO_CLI_VERSION}" | |
git push origin formula/momento-cli/v${MOMENTO_CLI_VERSION} | |
shell: bash | |