From 3cc439eb56c93f9ef968988cfb40411ca4806b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?txb=C3=AC?= <46839250+0xTxbi@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:29:32 +0100 Subject: [PATCH] chore(actions): Add Cloudflare Workers deployment workflow for RPC provider and Graph service (#14469) add action to deploy workers via github action --- .github/workflows/cloudflare-workers.yml | 70 ++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/cloudflare-workers.yml diff --git a/.github/workflows/cloudflare-workers.yml b/.github/workflows/cloudflare-workers.yml new file mode 100644 index 00000000000..49337252c27 --- /dev/null +++ b/.github/workflows/cloudflare-workers.yml @@ -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