Skip to content

sync_trigger

sync_trigger #26

name: Sync and Publish
on:
repository_dispatch:
types:
- sync_trigger
jobs:
sync-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Install bun
run: curl -fsSL https://bun.sh/install | bash
- name: Add bun to path
run: echo 'export BUN_INSTALL="$HOME/.bun"' >> $GITHUB_ENV
shell: bash
- name: Install dependencies
run: $HOME/.bun/bin/bun install
# prod (stable) - gets data from /networks
- name: Run (prod) fetch-contracts.ts
env:
LIT_ABI_SOURCE: prod
GH_LIT_ASSETS_READ_ONLY_API: ${{ secrets.GH_LIT_ASSETS_READ_ONLY_API }}
run: $HOME/.bun/bin/bun run fetch-contracts.ts
# dev (always updating) - gets data from /lit-assets
- name: Run (dev) fetch-contracts.ts
env:
LIT_ABI_SOURCE: dev
GH_LIT_ASSETS_READ_ONLY_API: ${{ secrets.GH_LIT_ASSETS_READ_ONLY_API }}
run: $HOME/.bun/bin/bun run fetch-contracts.ts
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "feat: Update contracts data" || echo "No changes to commit"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Bump version
run: npm version patch
- name: Commit and push version bump
run: |
git add package.json
git commit -m "chore: bump version" || echo "No version bump to commit"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Publish npm package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc && npm publish --access public