fix: validate for empty group ID/namespace (#284) #8
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
| # yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json | |
| --- | |
| name: Publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish-ea: | |
| if: startsWith(github.ref, 'refs/tags/') == false | |
| runs-on: ubuntu-latest | |
| name: Publish EA release to NPM | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| - name: Install node 24 | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Configure git | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Reset to commit | |
| run: | | |
| git reset --hard ${{ github.sha }} | |
| - name: Get current version | |
| id: current-version | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| # Remove both -ea. and -ea- formats for compatibility | |
| BASE_VERSION=$(echo "$VERSION" | sed -E 's/-ea[.-][0-9]+$//') | |
| echo "base-version=$BASE_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Install project modules | |
| run: npm ci | |
| - name: Compile project | |
| run: npm run compile | |
| - name: Publish package | |
| run: | | |
| SHORT_SHA=$(git rev-parse --short "${{ github.sha }}") | |
| EA_VERSION="${{ steps.current-version.outputs.base-version }}-ea.${SHORT_SHA}" | |
| npm version "$EA_VERSION" --no-git-tag-version | |
| npm publish --verbose --tag ea --access public --provenance | |
| publish-release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| name: Publish release to NPM | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref }} | |
| fetch-depth: 0 | |
| - name: Install node 24 | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Get tag name | |
| id: tag | |
| run: | | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| echo "name=$TAG_NAME" >> "$GITHUB_OUTPUT" | |
| - name: Update package.json with tag version | |
| id: update-version | |
| run: | | |
| TAG_NAME="${{ steps.tag.outputs.name }}" | |
| # Remove 'v' prefix if present | |
| VERSION=${TAG_NAME#v} | |
| npm version "$VERSION" --no-git-tag-version | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Install project modules | |
| run: npm ci | |
| - name: Compile project | |
| run: npm run compile | |
| - name: Publish package | |
| run: npm publish --verbose --access public --provenance |