Skip to content

menu hover feature #342

menu hover feature

menu hover feature #342

Workflow file for this run

name: Gateway
on:
workflow_dispatch:
push:
branches: [ chad ]
env:
AWS_REGION: us-east-1
ECR_REPOSITORY: yourplace-gateway
INSTANCE_NAME: yourplace-gateway
jobs:
build-and-deploy:
runs-on: ubuntu-latest
environment: production
permissions:
id-token: write
contents: read
actions: write
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Trigger Ubuntu Workflow
id: trigger-ubuntu
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "Triggering Ubuntu workflow..."
gh workflow run ubuntu.yml --ref ${{ github.ref }}
sleep 5
RUN_ID=$(gh run list --workflow=ubuntu.yml --limit 1 --json databaseId --jq '.[0].databaseId')
echo "run_id=$RUN_ID" >> $GITHUB_OUTPUT
echo "Ubuntu workflow run ID: $RUN_ID"
- name: Wait for Ubuntu Workflow to Complete
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ steps.trigger-ubuntu.outputs.run_id }}
run: |
echo "Waiting for Ubuntu workflow (Run ID: $RUN_ID) to complete..."
gh run watch $RUN_ID --exit-status
echo "Ubuntu workflow completed successfully!"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
with:
role-to-assume: arn:aws:iam::306570693158:role/gateway-github-actions
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
- name: Build and Push Docker Image
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -f gateway/Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Get EC2 Instance ID
id: get-instance
run: |
INSTANCE_ID=$(aws ec2 describe-instances \
--filters "Name=tag:Name,Values=${{ env.INSTANCE_NAME }}" \
"Name=instance-state-name,Values=running" \
--query 'Reservations[0].Instances[0].InstanceId' \
--region ${{ env.AWS_REGION }} \
--output text)
echo "instance_id=$INSTANCE_ID" >> $GITHUB_OUTPUT
echo "Instance ID: $INSTANCE_ID"
- name: Deploy to EC2
env:
INSTANCE_ID: ${{ steps.get-instance.outputs.instance_id }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
CLOUDFLARE_CERT_PEM: ${{ secrets.CLOUDFLARE_CERT_PEM }}
CLOUDFLARE_CERT_KEY: ${{ secrets.CLOUDFLARE_CERT_KEY }}
BASE_RPC_THROTTLE: ${{ vars.BASE_RPC_THROTTLE }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
GATEWAY_CATCHUP: ${{ vars.GATEWAY_CATCHUP }}
IPFS_PINNING_SHARED_SECRET: ${{ secrets.IPFS_PINNING_SHARED_SECRET }}
YOURPLACE_IPFS_PINNING_TYPE: ${{ secrets.YOURPLACE_IPFS_PINNING_TYPE }}
YOURPLACE_IPFS_PINNING_URL: ${{ secrets.YOURPLACE_IPFS_PINNING_URL }}
YOURPLACE_ORIGIN: ${{ vars.YOURPLACE_ORIGIN }}
run: |
chmod +x gateway/deploy.sh
./gateway/deploy.sh
- name: Flush Cloudflare Cache
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_PURGE_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
run: |
echo "Flushing Cloudflare cache for app.yourplace.network..."
sleep 30
response=$(curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"hosts":["app.yourplace.network"]}')
if echo "$response" | grep -q '"success":true'; then
echo "Cache flush successful!"
else
echo "Cache flush failed: $response"
exit 1
fi