Skip to content

Commit

Permalink
chore(actions): Add Cloudflare Workers deployment workflow for RPC pr…
Browse files Browse the repository at this point in the history
…ovider and Graph service (#14469)

add action to deploy workers via github action
  • Loading branch information
0xTxbi authored Aug 29, 2024
1 parent 5d1960a commit 3cc439e
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/cloudflare-workers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Deploy Cloudflare Workers

on:
push:
branches:
- master
paths:
- 'provider/**'
- 'graph-service/**'
pull_request:
paths:
- 'provider/**'
- 'graph-service/**'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
service: [provider, graph-service]
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: cd ${{ matrix.service }} && yarn install
- run: cd ${{ matrix.service }} && yarn test

deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
strategy:
matrix:
service: [provider, graph-service]
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: cd ${{ matrix.service }} && yarn install
- name: Set environment variables
run: |
if [ "${{ matrix.service }}" = "provider" ]; then
op run --env-file=${{ matrix.service }}/.op.env -- ./${{ matrix.service }}/scripts/set-provider-urls.sh
else
op run --env-file=${{ matrix.service }}/.op.env -- ./${{ matrix.service }}/scripts/set-graph-urls.sh
fi
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
- name: Deploy to Cloudflare Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: cd ${{ matrix.service }} && yarn deploy

0 comments on commit 3cc439e

Please sign in to comment.