Publish Contract Addresses #15
This file contains hidden or 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 Contract Addresses | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: npm ci | |
| - run: npm run fetch | |
| - name: Check for changes | |
| id: changes | |
| run: | | |
| git add data/ | |
| if git diff --staged --quiet; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish if changed | |
| if: steps.changes.outputs.changed == 'true' | |
| run: | | |
| VERSION="1.0.$(date +%Y%m%d%H%M%S)" | |
| npm version $VERSION --no-git-tag-version | |
| npm run build | |
| echo "Checking npm auth status..." | |
| npm whoami || echo "Not authenticated" | |
| npm publish --access public --registry https://registry.npmjs.org/ | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| git add . | |
| git commit -m "Update addresses v$VERSION" | |
| git push | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |