Merge pull request #38 from BlockStudiosMC/main #56
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: Registry CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| - run: npm ci | |
| - run: npm run build | |
| publish: | |
| if: github.ref == 'refs/heads/main' | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.x' | |
| 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 |