Release CLI #110
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
# This defines a workflow to build and release a new version of the aptos CLI. | |
# In order to trigger it go to the Actions Tab of the Repo, click "Release CLI" and then "Run Workflow". | |
name: "Release CLI" | |
on: | |
workflow_dispatch: | |
inputs: | |
release_version: | |
type: string | |
required: true | |
description: "The release version. E.g. `0.2.3`:" | |
source_git_ref_override: | |
type: string | |
required: false | |
description: "GIT_SHA_OVERRIDE: Use this to override the Git SHA1, branch name (e.g. devnet) or tag to build the binaries from. Defaults to the workflow Git REV, but can be different than that:" | |
dry_run: | |
type: boolean | |
required: false | |
default: true | |
description: "Dry run - If checked, the release will not be created" | |
jobs: | |
build-ubuntu20-binary: | |
name: "Build Ubuntu 20.04 binary" | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.source_git_ref_override }} | |
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main | |
- name: Build CLI | |
run: scripts/cli/build_cli_release.sh "Ubuntu" | |
- name: Upload Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cli-builds-ubuntu-20.04 | |
path: aptos-cli-*.zip | |
build-ubuntu22-binary: | |
name: "Build Ubuntu 22.04 binary" | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.source_git_ref_override }} | |
- uses: aptos-labs/aptos-core/.github/actions/rust-setup@main | |
- name: Build CLI | |
run: scripts/cli/build_cli_release.sh "Ubuntu-22.04" | |
- name: Upload Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cli-builds-ubuntu-22.04 | |
path: aptos-cli-*.zip | |
build-windows-binary: | |
name: "Build Windows binary" | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.source_git_ref_override }} | |
- name: Build CLI | |
run: scripts\cli\build_cli_release.ps1 | |
- name: Upload Binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cli-builds-windows | |
path: aptos-cli-*.zip | |
release-binaries: | |
name: "Release binaries" | |
needs: | |
- build-ubuntu20-binary | |
- build-ubuntu22-binary | |
- build-windows-binary | |
runs-on: ubuntu-latest | |
permissions: | |
contents: "write" | |
pull-requests: "read" | |
if: ${{ inputs.dry_run }} == 'false' | |
steps: | |
- name: Download prebuilt binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: cli-builds-* | |
merge-multiple: true | |
- name: Create GitHub Release | |
uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0 # [email protected] | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{ format('aptos-cli-v{0}', inputs.release_version) }}" | |
prerelease: false | |
title: "${{ format('Aptos CLI Release v{0}', inputs.release_version) }}" | |
files: | | |
aptos-cli-*.zip | |
bump-homebrew-version-pr: | |
name: "Make PR to bump version in Homebrew" | |
needs: | |
- release-binaries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: mislav/bump-homebrew-formula-action@v3 | |
with: | |
formula-name: aptos | |
tag-name: "${{ format('aptos-cli-v{0}', inputs.release_version) }}" | |
base-branch: master | |
create-pullrequest: true | |
commit-message: | | |
{{formulaName}} {{version}} | |
Created by https://github.com/mislav/bump-homebrew-formula-action | |
From CLI release run ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
env: | |
COMMITTER_TOKEN: ${{ secrets.APTOS_BOT_GH_PAT_APTOS_CORE_HOMEBREW_BUMPER }} |