Skip to content

Commit

Permalink
ci: ensure the subgraph deployment is done after the package publicat…
Browse files Browse the repository at this point in the history
…ion (#843)
  • Loading branch information
levalleux-ludo authored Nov 19, 2024
1 parent 4808f58 commit 74e580b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/deploy-testing-subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: Deploy subgraph to testing env

on:
workflow_dispatch:
push:
branches:
- main
paths:
- packages/subgraph/**
workflow_call:
secrets:
ORMI_0x_GRAPH_API_KEY_TESTING:
required: true
BSNORG_ACTIONS_SECRET:
required: true

jobs:
deploy:
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/publish-alpha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
publish:
name: Publish alpha packages
runs-on: ubuntu-latest
outputs:
SUBGRAPH_CHANGES: ${{ steps.export-changed-subgraph-files.outputs.SUBGRAPH_CHANGES }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -47,7 +49,22 @@ jobs:
--no-git-tag-version \
--no-changelog \
--no-push
- name: Get all changed files in subgraph workspace
id: changed-subgraph-files
uses: tj-actions/changed-files@v45
with:
files: packages/subgraph/**
- name: Export if changed files in subgraph workspace
id: export-changed-subgraph-files
env:
SUBGRAPH_CHANGES: ${{ steps.changed-subgraph-files.outputs.any_changed }}
run: |
echo "SUBGRAPH_CHANGES=$SUBGRAPH_CHANGES" >> "$GITHUB_OUTPUT"
- name: Commit changes
env:
GH_TOKEN: ${{ secrets.BSNORG_ACTIONS_SECRET }}
GITHUB_TOKEN: ${{ secrets.BSNORG_ACTIONS_SECRET }}
run: |
git add .
git commit -m "chore(release): publish alpha [skip ci]"
- name: Publish to npm
Expand All @@ -57,3 +74,12 @@ jobs:
run: |
npx lerna publish from-package --dist-tag alpha --yes
git push
call-deploy-testing-subgraph:
uses: ./.github/workflows/deploy-testing-subgraph.yaml
# condition only if packages/subgraph workspace has changed
needs: publish
if: ${{ needs.publish.outputs.SUBGRAPH_CHANGES }}
secrets:
ORMI_0x_GRAPH_API_KEY_TESTING: ${{ secrets.ORMI_0x_GRAPH_API_KEY_TESTING }}
BSNORG_ACTIONS_SECRET: ${{ secrets.BSNORG_ACTIONS_SECRET }}

0 comments on commit 74e580b

Please sign in to comment.