Skip to content

Merge pull request #31 from JeanLucasMCPE/patch-3 #35

Merge pull request #31 from JeanLucasMCPE/patch-3

Merge pull request #31 from JeanLucasMCPE/patch-3 #35

Workflow file for this run

name: Registry CI
on:
pull_request:
push:
branches:
- main
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run build
publish:
if: github.ref == 'refs/heads/main'
needs: validate
runs-on: ubuntu-latest
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 build
- name: Publish new version
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
LATEST=$(npm view @bedrock-oss/add-on-registry version || echo "1.0.0")
LOCAL=$(node -p "require('./package.json').version")
if [ "$LATEST" = "$LOCAL" ]; then
echo "Version already published, bumping patch..."
npm version patch --no-git-tag-version
fi
NEW_VERSION=$(node -p "require('./package.json').version")
npm publish --access public
git add package.json package-lock.json
git commit -m "release: $NEW_VERSION" || echo "No changes to commit"
git push origin HEAD:main --follow-tags
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}