Release #18
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to release (e.g., v0.5.3)' | |
| required: true | |
| default: 'v0.5.3' | |
| jobs: | |
| verify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.17.0' | |
| cache: 'npm' | |
| - run: npm ci | |
| - run: npm --prefix demo ci | |
| - run: npm run lint:check | |
| - run: npm run typecheck | |
| - run: npm run build | |
| - run: npm run web:build | |
| - run: npm run build:verify | |
| - run: npm run pack:check | |
| - run: npm test | |
| release: | |
| needs: verify | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event_name == 'push' && github.ref || github.sha }} | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22.17.0' | |
| package-manager-cache: false | |
| - run: npm install -g npm@11.9.0 | |
| - run: npm --version | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npm run build:verify | |
| - name: Resolve tag | |
| id: release_tag | |
| run: | | |
| if [ -n "${{ inputs.tag }}" ]; then | |
| echo "TAG=${{ inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get version | |
| id: version | |
| run: | | |
| TAG="${{ steps.release_tag.outputs.TAG }}" | |
| echo "VERSION=${TAG#v}" >> $GITHUB_OUTPUT | |
| - name: Verify version match | |
| run: | | |
| PKG_VERSION=$(node -p "require('./package.json').version") | |
| TAG_VERSION=${{ steps.version.outputs.VERSION }} | |
| if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Version mismatch: package.json=$PKG_VERSION tag=$TAG_VERSION" | |
| exit 1 | |
| fi | |
| - name: Extract release notes | |
| run: | | |
| node -e " | |
| const fs = require('fs'); | |
| const changelog = fs.readFileSync('CHANGELOG.md', 'utf-8'); | |
| const version = '${{ steps.version.outputs.VERSION }}'; | |
| const regex = new RegExp('## \\\\[' + version.replace(/\\./g, '\\\\.') + '\\\\].*?\\n([\\\\s\\\\S]*?)(?=\\n## \\\\[|$)'); | |
| const match = regex.exec(changelog); | |
| const notes = match ? match[1].trim() : 'See CHANGELOG.md for details.'; | |
| fs.writeFileSync('RELEASE_NOTES_EXTRACTED.md', notes); | |
| " | |
| - name: Check lumina-lang version | |
| id: lumina_lang_exists | |
| run: | | |
| if npm view lumina-lang@${{ steps.version.outputs.VERSION }} version >/dev/null 2>&1; then | |
| echo "exists=1" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=0" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Skip lumina-lang publish (already exists) | |
| if: steps.lumina_lang_exists.outputs.exists == '1' | |
| run: echo "lumina-lang@${{ steps.version.outputs.VERSION }} already published; skipping." | |
| - name: Publish lumina-lang | |
| if: steps.lumina_lang_exists.outputs.exists != '1' | |
| run: npm publish --access public | |
| - name: Build lumina-language-client | |
| run: | | |
| cd packages/lumina-language-client | |
| npm ci | |
| npm run build | |
| - name: Verify lumina-language-client version match | |
| run: | | |
| CLIENT_VERSION=$(node -p "require('./packages/lumina-language-client/package.json').version") | |
| TAG_VERSION=${{ steps.version.outputs.VERSION }} | |
| if [ "$CLIENT_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Version mismatch: packages/lumina-language-client/package.json=$CLIENT_VERSION tag=$TAG_VERSION" | |
| exit 1 | |
| fi | |
| - name: Check lumina-language-client version | |
| id: lumina_client_exists | |
| run: | | |
| if npm view lumina-language-client@${{ steps.version.outputs.VERSION }} version >/dev/null 2>&1; then | |
| echo "exists=1" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=0" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Skip lumina-language-client publish (already exists) | |
| if: steps.lumina_client_exists.outputs.exists == '1' | |
| run: echo "lumina-language-client@${{ steps.version.outputs.VERSION }} already published; skipping." | |
| - name: Publish lumina-language-client | |
| if: steps.lumina_client_exists.outputs.exists != '1' | |
| run: | | |
| cd packages/lumina-language-client | |
| npm publish --access public | |
| - name: Publish VS Code extension | |
| run: | | |
| cd vscode-extension | |
| npm pkg set "dependencies.lumina-language-client=${{ steps.version.outputs.VERSION }}" | |
| npm ci --workspaces=false | |
| npm run build | |
| npx @vscode/vsce publish --pat ${{ secrets.VSCE_PAT }} | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| NPM_CONFIG_WORKSPACES: "false" | |
| NPM_CONFIG_INSTALL_LINKS: "false" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.release_tag.outputs.TAG }} | |
| target_commitish: ${{ github.sha }} | |
| name: "Lumina v${{ steps.version.outputs.VERSION }}" | |
| body_path: RELEASE_NOTES_EXTRACTED.md | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |