Fix/build_types #5
Workflow file for this run
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
name: Publish to IPFS | |
on: | |
workflow_dispatch: | |
pull_request: | |
env: | |
SUBQL_ACCESS_TOKEN: ${{ secrets.SUBQUERY_TOKEN }} | |
permissions: | |
contents: write | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
project_files: ${{ steps.project_files.outputs.files }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 🧾 Get list of projects | |
id: project_files | |
run: | | |
chmod +x .github/get_all_project_files.sh | |
echo "::set-output name=files::$(.github/get_all_project_files.sh)" | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: 🔄 Install dependencies | |
run: yarn install | |
- name: 🧬 Types generation | |
run: yarn codegen | |
- name: 🏗 Build from sources | |
run: yarn build | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: build | |
path: | | |
dist | |
src/types | |
deploy-to-IPFS: | |
needs: setup | |
name: 📬 Deploy to SubQuery IPFS | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 5 | |
matrix: ${{fromJson(needs.setup.outputs.project_files)}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: 🔄 Install dependencies | |
run: yarn install | |
- uses: actions/download-artifact@v2 | |
with: | |
name: build | |
path: . | |
- name: 📬 Deploy to IPFS | |
run: | | |
./node_modules/.bin/subql publish -f ${{ matrix.project_file }} -o | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: cids | |
path: .*cid | |
push-changed-cids: | |
needs: deploy-to-IPFS | |
name: 🏹 Push changes to branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download built artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: cids | |
path: ./ipfs-cids | |
- name: ➡️ Commit files | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add -f ipfs-cids | |
git commit -m "Update CIDs for IFPS" | |
- name: 🏹 Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: refs/heads/update-cids-${{github.run_number}} |