sync_trigger #14
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: 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" | |
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" | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Publish npm package | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |