execute-release #68
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@v4 | |
- 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 "release=${{ steps.semrel.outputs.version }}" >> $GITHUB_OUTPUT | |
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@v4 | |
- 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-1.${{ matrix.architecture.rpm-arch-shortname }}.rpm" | |
[ -e $BINARY_FILE ] || { echo "Expected rpm output file not found!: '${BINARY_FILE}'"; exit 1; } | |
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" | |
[ -e $BINARY_FILE ] || { echo "Expected deb output file not found!: '${BINARY_FILE}'"; exit 1; } | |
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@v4 | |
- 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@v4 | |
- 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 "momento_binary_path=.\target\x86_64-pc-windows-gnu\release\momento.exe" >> $ENV:GITHUB_OUTPUT | |
$distributableFile64Prefix = "momento-cli-$env:VERSION.windows_x64" | |
echo "distributable_file_prefix=$distributableFile64Prefix" >> $ENV:GITHUB_OUTPUT | |
- name: Write client auth certificate file | |
id: write_client_auth_cert | |
env: | |
CLIENT_AUTH_CERT_BASE64_CONTENT: ${{ secrets.CODE_SIGNING_CERT_BASE64 }} | |
run: | | |
$p12Path = "cert.p12"; | |
$encodedBytes = [System.Convert]::FromBase64String($env:CLIENT_AUTH_CERT_BASE64_CONTENT); | |
Set-Content $p12Path -Value $encodedBytes -AsByteStream; | |
echo "p12_path=$p12Path" >> $ENV:GITHUB_OUTPUT | |
- name: Download digicert smtools | |
env: | |
SM_API_KEY: ${{ secrets.CODE_SIGNING_API_KEY }} | |
run: | | |
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi | |
shell: cmd | |
- name: Install digicert smtools | |
run: | | |
$procMain = Start-Process "msiexec" "/i smtools-windows-x64.msi /qn /l*! msi_install.log" -NoNewWindow -PassThru | |
echo $null >> msi_install.log | |
$procLog = Start-Process "powershell" "Get-Content -Path msi_install.log -Wait" -NoNewWindow -PassThru | |
$procMain.WaitForExit() | |
$procLog.Kill() | |
shell: powershell | |
- name: Add digicert tools to path | |
run: | | |
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH | |
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH | |
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH | |
shell: bash | |
- name: Check path | |
run: | | |
echo %path% | |
shell: cmd | |
- name: List digicert dir | |
run: | | |
dir "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" | |
shell: cmd | |
- name: Verify KSP Registration | |
env: | |
SM_HOST: ${{ secrets.CODE_SIGNING_HOST }} | |
SM_API_KEY: ${{ secrets.CODE_SIGNING_API_KEY }} | |
SM_CLIENT_CERT_FILE: "${{ steps.write_client_auth_cert.outputs.p12_path }}" | |
SM_CLIENT_CERT_PASSWORD: ${{ secrets.CODE_SIGNING_CERT_PASSWORD }} | |
run: | | |
dir | |
smksp_registrar.exe list | |
smctl.exe keypair ls | |
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user | |
smksp_cert_sync.exe | |
smctl healthcheck | |
shell: cmd | |
- name: Sign Momento binary | |
env: | |
MOMENTO_BINARY_PATH: ${{ steps.build.outputs.momento_binary_path }} | |
SM_HOST: ${{ secrets.CODE_SIGNING_HOST }} | |
SM_API_KEY: ${{ secrets.CODE_SIGNING_API_KEY }} | |
SM_CLIENT_CERT_FILE: "${{ steps.write_client_auth_cert.outputs.p12_path }}" | |
SM_CLIENT_CERT_PASSWORD: ${{ secrets.CODE_SIGNING_CERT_PASSWORD }} | |
run: | | |
signtool.exe sign /sha1 ${{ secrets.CODE_SIGNING_CERT_SHA1_HASH }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $env:MOMENTO_BINARY_PATH | |
signtool.exe verify /v /pa $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 "asset_path=$zipPath" >> $ENV:GITHUB_OUTPUT | |
echo "asset_name=$zipFilename" >> $ENV:GITHUB_OUTPUT | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- 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 "asset_path=$msiPath" >> $ENV:GITHUB_OUTPUT | |
echo "asset_name=$msiFilename" >> $ENV:GITHUB_OUTPUT | |
- name: Sign installer | |
env: | |
MSI_PATH: ${{ steps.build_installer.outputs.asset_path }} | |
SM_HOST: ${{ secrets.CODE_SIGNING_HOST }} | |
SM_API_KEY: ${{ secrets.CODE_SIGNING_API_KEY }} | |
SM_CLIENT_CERT_FILE: "${{ steps.write_client_auth_cert.outputs.p12_path }}" | |
SM_CLIENT_CERT_PASSWORD: ${{ secrets.CODE_SIGNING_CERT_PASSWORD }} | |
run: | | |
signtool.exe sign /sha1 ${{ secrets.CODE_SIGNING_CERT_SHA1_HASH }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $env:MSI_PATH | |
signtool.exe verify /v /pa $env:MSI_PATH | |
- name: Delete PFX certificate | |
env: | |
CERT_PATH: "${{ steps.write_client_auth_cert.outputs.p12_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 "upload_url_msi=$ghAssetMsi" >> $ENV:GITHUB_OUTPUT | |
echo "upload_url_zip=$ghAssetZip" >> $ENV:GITHUB_OUTPUT | |
- 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 "installer_url=$installerUrl" >> $ENV:GITHUB_OUTPUT | |
- 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@v4 | |
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 "[email protected]" | |
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 |