File tree Expand file tree Collapse file tree 4 files changed +65
-12
lines changed
Expand file tree Collapse file tree 4 files changed +65
-12
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,14 @@ concurrency:
1616jobs :
1717 hosting-photo-storage-darwin :
1818 runs-on : macos-15
19- env :
20- ICP_CLI_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2119 steps :
2220 - uses : actions/checkout@v1
2321 - name : Provision Darwin
2422 run : bash .github/workflows/provision-darwin.sh
23+ - name : Pre-download network launcher
24+ env :
25+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26+ run : bash .github/workflows/pre-download-launcher.sh
2527 - name : Hosting Photo Storage Darwin
2628 run : |
2729 pushd hosting/photo-storage
@@ -32,12 +34,14 @@ jobs:
3234 popd
3335 hosting-photo-storage-linux :
3436 runs-on : ubuntu-22.04
35- env :
36- ICP_CLI_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3737 steps :
3838 - uses : actions/checkout@v1
3939 - name : Provision Linux
4040 run : bash .github/workflows/provision-linux.sh
41+ - name : Pre-download network launcher
42+ env :
43+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44+ run : bash .github/workflows/pre-download-launcher.sh
4145 - name : Hosting Photo Storage Linux
4246 run : |
4347 pushd hosting/photo-storage
Original file line number Diff line number Diff line change @@ -16,12 +16,14 @@ concurrency:
1616jobs :
1717 hosting-static-website-darwin :
1818 runs-on : macos-15
19- env :
20- ICP_CLI_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2119 steps :
2220 - uses : actions/checkout@v1
2321 - name : Provision Darwin
2422 run : bash .github/workflows/provision-darwin.sh
23+ - name : Pre-download network launcher
24+ env :
25+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26+ run : bash .github/workflows/pre-download-launcher.sh
2527 - name : Hosting Static Website Darwin
2628 run : |
2729 pushd hosting/static-website
@@ -30,12 +32,14 @@ jobs:
3032 popd
3133 hosting-static-website-linux :
3234 runs-on : ubuntu-22.04
33- env :
34- ICP_CLI_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3535 steps :
3636 - uses : actions/checkout@v1
3737 - name : Provision Linux
3838 run : bash .github/workflows/provision-linux.sh
39+ - name : Pre-download network launcher
40+ env :
41+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42+ run : bash .github/workflows/pre-download-launcher.sh
3943 - name : Hosting Static Website Linux
4044 run : |
4145 pushd hosting/static-website
Original file line number Diff line number Diff line change @@ -16,12 +16,14 @@ concurrency:
1616jobs :
1717 hosting-unity-webgl-darwin :
1818 runs-on : macos-15
19- env :
20- ICP_CLI_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2119 steps :
2220 - uses : actions/checkout@v1
2321 - name : Provision Darwin
2422 run : bash .github/workflows/provision-darwin.sh
23+ - name : Pre-download network launcher
24+ env :
25+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
26+ run : bash .github/workflows/pre-download-launcher.sh
2527 - name : Hosting Unity Webgl Darwin
2628 run : |
2729 pushd hosting/unity-webgl-template
@@ -30,12 +32,14 @@ jobs:
3032 popd
3133 hosting-unity-webgl-linux :
3234 runs-on : ubuntu-22.04
33- env :
34- ICP_CLI_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3535 steps :
3636 - uses : actions/checkout@v1
3737 - name : Provision Linux
3838 run : bash .github/workflows/provision-linux.sh
39+ - name : Pre-download network launcher
40+ env :
41+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42+ run : bash .github/workflows/pre-download-launcher.sh
3943 - name : Hosting Unity Webgl Linux
4044 run : |
4145 pushd hosting/unity-webgl-template
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Pre-download the icp-cli network launcher to avoid GitHub API rate limits.
3+ # icp-cli v0.1.0 doesn't support ICP_CLI_GITHUB_TOKEN yet, so `icp network start`
4+ # hits the unauthenticated GitHub API rate limit (60 req/hr) when fetching the
5+ # latest launcher version. This script uses the authenticated `gh` CLI to get
6+ # the version, downloads the binary directly, and sets ICP_CLI_NETWORK_LAUNCHER_PATH
7+ # so icp-cli skips the API call entirely.
8+ #
9+ # Requires: GH_TOKEN env var (for authenticated GitHub API access via gh CLI)
10+ #
11+ # This workaround can be removed once icp-cli supports ICP_CLI_GITHUB_TOKEN.
12+ set -ex
13+
14+ VERSION=$( gh release view --repo dfinity/icp-cli-network-launcher --json tagName -q .tagName)
15+
16+ ARCH=$( uname -m)
17+ case " $ARCH " in
18+ arm64|aarch64) ARCH=" arm64" ;;
19+ x86_64) ARCH=" x86_64" ;;
20+ * ) echo " Unsupported architecture: $ARCH " ; exit 1 ;;
21+ esac
22+
23+ OS=$( uname -s)
24+ case " $OS " in
25+ Darwin) OS=" darwin" ;;
26+ Linux) OS=" linux" ;;
27+ * ) echo " Unsupported OS: $OS " ; exit 1 ;;
28+ esac
29+
30+ TARBALL=" icp-cli-network-launcher-${ARCH} -${OS} -${VERSION} "
31+ URL=" https://github.com/dfinity/icp-cli-network-launcher/releases/download/${VERSION} /${TARBALL} .tar.gz"
32+
33+ LAUNCHER_DIR=" $HOME /.icp-cli-launcher"
34+ mkdir -p " $LAUNCHER_DIR "
35+ curl -sL " $URL " | tar xz -C " $LAUNCHER_DIR "
36+
37+ LAUNCHER_PATH=" ${LAUNCHER_DIR} /${TARBALL} /icp-cli-network-launcher"
38+ chmod +x " $LAUNCHER_PATH "
39+
40+ echo " ICP_CLI_NETWORK_LAUNCHER_PATH=${LAUNCHER_PATH} " >> " $GITHUB_ENV "
41+ echo " Network launcher ${VERSION} downloaded to ${LAUNCHER_PATH} "
You can’t perform that action at this time.
0 commit comments