π Autofix #27
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 | |
on: | |
- push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: write | |
strategy: | |
matrix: | |
node-version: | |
- "20" | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm i | |
- run: npm run format | |
- name: commit auto fixes | |
env: | |
USERNAME: ${{ github.actor }} | |
BRANCH: ${{ github.ref_name }} | |
REPO: ${{ github.repository }} | |
run: | | |
if [ "$(git diff --quiet && echo 0 || echo $?)" -gt 0 ]; then | |
git config --global user.email "${USERNAME}@users.noreply.github.com" --replace-all | |
git config --global user.name "$USERNAME" --replace-all | |
git commit -am "π Autofix" | |
git remote set-url origin https://github.com/$REPO.git | |
git push origin $BRANCH | |
exit 1 | |
fi | |
- name: Build and Publish | |
if: github.ref == 'refs/heads/main' | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
npx @lets/publish |