Update README examples to use v4 #41
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: Compile and push dist file | |
on: [push, pull_request] | |
jobs: | |
compile-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- if: github.event_name != 'pull_request' | |
uses: actions/checkout@v4 | |
- if: github.event_name == 'pull_request' | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Compile with ncc | |
run: | | |
npm install | |
npx ncc build src/index.ts -o dist | |
- name: Push | |
env: | |
DIR: dist | |
run: | | |
if git diff --exit-code $DIR | |
then | |
exit 0 | |
fi | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add $DIR/* | |
git commit -m "Update dist/index.js" | |
git push |