-
-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(actions): Add Cloudflare Workers deployment workflow for RPC pr…
…ovider and Graph service (#14469) add action to deploy workers via github action
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 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,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 |