Skip to content

Commit 2890589

Browse files
committed
init
1 parent e356015 commit 2890589

File tree

2 files changed

+121
-0
lines changed

2 files changed

+121
-0
lines changed

.github/workflows/cli-publish.yaml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Checkout Aptos CLI Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Aptos CLI version (e.g., v5.1.0)'
8+
required: true
9+
10+
jobs:
11+
checkout_version:
12+
runs-on: windows-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
- name: Checkout Aptos CLI version
18+
run: |
19+
# 获取输入的版本号
20+
$env:VERSION = "${{ github.event.inputs.version }}"
21+
22+
# 检出 Aptos CLI 仓库
23+
git clone https://github.com/aptos-labs/aptos-core.git
24+
cd aptos-core
25+
26+
git fetch --tags
27+
git checkout "aptos-cli-$env:VERSION"
28+
29+
echo "Checked out version: $env:VERSION"
30+
31+
- name: Download and Extract Aptos CLI release
32+
run: |
33+
$env:No_v_VERSION = "${{ github.event.inputs.version }}".Substring(1)
34+
$env:VERSION = "${{ github.event.inputs.version }}"
35+
$NAME="aptos-cli"
36+
$ZIP_NAME="$NAME-$env:No_v_VERSION-Windows-x86_64.zip"
37+
$URL = "https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-$env:VERSION/$ZIP_NAME"
38+
$DEST_DIR = "./target/cli"
39+
40+
cd aptos-core
41+
42+
New-Item -Path $DEST_DIR -ItemType Directory -Force
43+
44+
Invoke-WebRequest -Uri $URL -OutFile "$DEST_DIR\$ZIP_NAME"
45+
Expand-Archive -Path "$DEST_DIR\$ZIP_NAME" -DestinationPath $DEST_DIR
46+
47+
ls ./target/cli
48+
49+
Write-Host "Aptos CLI version $env:VERSION extracted to $DEST_DIR"
50+
51+
- name: Publish to Choco
52+
run: |
53+
54+
cd aptos-core
55+
56+
New-Item -Path chocolatey -ItemType Directory -Force
57+
58+
Copy-Item ..\aptos.nuspec -Destination ./chocolatey/aptos.nuspec
59+
60+
$NAME="aptos-cli"
61+
$CRATE_NAME="aptos"
62+
$CARGO_PATH="crates\$CRATE_NAME\Cargo.toml"
63+
$VERSION = Get-Content $CARGO_PATH | Select-String -Pattern '^\w*version = "(\d*\.\d*.\d*)"' | % {"$($_.matches.groups[1])"}
64+
$ExePath = "target\cli\$CRATE_NAME.exe"
65+
$CHOCO_API_KEY = ${{ secrets.CHOCO_API_KEY }}
66+
$apiKey = $env:CHOCO_API_KEY
67+
$ZIP_NAME="$NAME-$VERSION-Windows-x86_64.zip"
68+
69+
choco install checksum -y
70+
71+
$aptosHash = & checksum -t sha256 $ExePath
72+
73+
Set-Location -Path "chocolatey"
74+
75+
@'
76+
Aptos Binary verification steps
77+
1. Download https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-$VERSION/$ZIP_NAME
78+
2. Extract aptos.exe
79+
3. Verify binary: checksum.exe -t sha256 aptos.exe: $aptosHash
80+
81+
File 'LICENSE.txt' is obtained from: https://github.com/aptos-labs/aptos-core/blob/main/LICENSE
82+
'@ | Out-File -FilePath "VERIFICATION.txt" -Encoding utf8 -Append
83+
84+
Copy-Item ..\LICENSE -Destination LICENSE.txt
85+
86+
choco pack --version $VERSION configuration=release
87+
88+
ls
89+
90+
choco apikey --api-key $apiKey --source https://push.chocolatey.org/
91+
92+
choco push aptos.$VERSION.nupkg --source https://push.chocolatey.org/
93+
94+
Set-Location -Path ".."

aptos.nuspec

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter
3+
enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
4+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
5+
<metadata>
6+
<id>aptos</id>
7+
<version>$version$</version>
8+
<owners>WGB5445</owners>
9+
<title>Aptos Binary</title>
10+
<authors>aptos</authors>
11+
<projectUrl>https://aptosfoundation.org/</projectUrl>
12+
<licenseUrl>https://github.com/aptos-labs/aptos-core/blob/main/LICENSE</licenseUrl>
13+
<iconUrl>https://avatars.githubusercontent.com/u/99841612</iconUrl>
14+
<projectSourceUrl>https://github.com/aptos-labs/aptos-core/</projectSourceUrl>
15+
<bugTrackerUrl>https://github.com/aptos-labs/aptos-core/issues</bugTrackerUrl>
16+
<tags>aptos</tags>
17+
<packageSourceUrl>https://community.chocolatey.org/packages/aptos</packageSourceUrl>
18+
<summary>Run a local aptos binary</summary>
19+
<description>Aptos is a layer 1 blockchain built to support the widespread use of blockchain through better technology and user experience.</description>
20+
<releaseNotes>https://github.com/aptos-labs/aptos-core/releases/tag/aptos-cli-v$version$</releaseNotes>
21+
</metadata>
22+
<files>
23+
<file src="../target/cli/aptos.exe" target="bin/aptos.exe" />
24+
<file src="./LICENSE.txt" target="bin/LICENSE.txt" />
25+
<file src="./VERIFICATION.txt" target="bin/VERIFICATION.txt" />
26+
</files>
27+
</package>

0 commit comments

Comments
 (0)