-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/tx-history
- Loading branch information
Showing
17 changed files
with
3,991 additions
and
126 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Pin to ipfs cluster and nodes | ||
description: Upload build to ipfs node | ||
inputs: | ||
BUILD_PATH: | ||
description: path to the build directory | ||
required: true | ||
DOMAIN: | ||
description: Domain to unpin | ||
required: true | ||
GCP_SA_KEY: | ||
description: '' | ||
required: true | ||
GKE_CLUSTER: | ||
description: '' | ||
required: true | ||
GKE_CLUSTER_REGION: | ||
description: '' | ||
required: true | ||
PINATA_HASH: | ||
description: '' | ||
required: true | ||
IPFS_SERVER_PORT: | ||
description: '' | ||
required: true | ||
IPFS_SERVER: | ||
description: '' | ||
required: true | ||
IPFS_SERVER_KEY: | ||
description: '' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: GCP Auth | ||
uses: google-github-actions/auth@ceee102ec2387dd9e844e01b530ccd4ec87ce955 # v0.8.0 | ||
with: | ||
credentials_json: '${{ inputs.GCP_SA_KEY }}' | ||
- name: Get GKE credentials | ||
uses: google-github-actions/get-gke-credentials@054fdb05e32039f72764f03e69e6acb20caa6f56 # v0.8.0 | ||
with: | ||
cluster_name: '${{ inputs.GKE_CLUSTER }}' | ||
location: '${{ inputs.GKE_CLUSTER_REGION }}' | ||
- uses: azure/setup-kubectl@7f7e5ba5ea3e491b92e6e8e5819963f8f3a1f076 # v3 | ||
with: | ||
version: 'v1.22.13' | ||
|
||
- name: GKE ipfs cluster pin | ||
shell: bash | ||
run: | | ||
export POD_NAME="ipfs-cluster-$(($RANDOM % 3))" | ||
tar -czf app.tar.gz './${{ inputs.BUILD_PATH }}' | ||
kubectl -n ipfs-cluster cp -c ipfs ./app.tar.gz ${POD_NAME}:/root/ | ||
echo "Uploading build..." | ||
IPFS_HASH="$(kubectl -n ipfs-cluster exec -i ${POD_NAME} -c ipfs -- sh -c \ | ||
'cd /root/ && tar -zxf app.tar.gz && \ | ||
ipfs add -rQ --cid-version=1 --pin=false ./${{ inputs.BUILD_PATH }}/ && \ | ||
rm -rf ./app.tar.gz ./${{ inputs.BUILD_PATH }}')" | ||
echo "Pinning to cluster..." | ||
kubectl -n ipfs-cluster exec -i ${POD_NAME} -c ipfs-cluster -- \ | ||
ipfs-cluster-ctl pin add --wait --wait-timeout=180s \ | ||
--replication-min=1 --name='app-aave-${{ github.sha }}' \ | ||
"${IPFS_HASH}" | ||
- name: Prepare env and Compress build on IPFS servers | ||
id: ipfs-prepare | ||
continue-on-error: false | ||
shell: bash | ||
run: | | ||
rm -rf ./key | ||
echo -n "${{ inputs.IPFS_SERVER_KEY }}" | base64 -d >> ./key | ||
chmod 400 ./key | ||
- name: Upload build to IPFS Primary Server | ||
id: ipfs-scp-primary | ||
continue-on-error: false | ||
shell: bash | ||
run: | | ||
scp -o StrictHostKeyChecking=no \ | ||
-i ./key \ | ||
-P \${{ inputs.IPFS_SERVER_PORT }} app.tar.gz ipfs@\${{ inputs.IPFS_SERVER }}:. | ||
ssh -o StrictHostKeyChecking=no \ | ||
-p \${{ inputs.IPFS_SERVER_PORT }} \ | ||
-i ./key ipfs@\${{ inputs.IPFS_SERVER }} "tar zxf app.tar.gz && ipfs add -rQ --cid-version=1 ./${{ inputs.BUILD_PATH }}/" | ||
- name: Clean build and tmp directory on Servers | ||
continue-on-error: false | ||
id: ipfs-clean | ||
shell: bash | ||
run: | | ||
ssh -o StrictHostKeyChecking=no \ | ||
-p \${{ inputs.IPFS_SERVER_PORT }} \ | ||
-i ./key ipfs@\${{ inputs.IPFS_SERVER }} "rm -rf ./${{ inputs.BUILD_PATH }}/ app.tar.gz" |
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
Oops, something went wrong.