fix(js_parser): allow return statements in Astro frontmatter (#8302) #1467
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: | |
| branches: | |
| - main | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| actions: write | |
| contents: write | |
| pull-requests: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| BIOME_WEBSITE_REPO: biomejs/website | |
| BIOME_DOCKER_REPO: biomejs/docker | |
| BIOME_RELEASE_CLI_EVENT: biome-release-cli-event | |
| jobs: | |
| changesets: | |
| name: Release | |
| outputs: | |
| hasChangesets: ${{ steps.changesets-action.outputs.hasChangesets }} | |
| runs-on: depot-ubuntu-24.04-arm-small | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Install Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 24.11.1 | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack | |
| corepack enable | |
| pnpm --version | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Update rule version metadata | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ripgrep | |
| pnpm exec changeset status --output="changeset_status.json" | |
| NEW_VERSION=$(jq -r '.releases[] | select(.name=="@biomejs/biome") | .newVersion' changeset_status.json) | |
| rm changeset_status.json | |
| if [ -z "$NEW_VERSION" ]; then | |
| echo "No new @biomejs/biome version detected; skipping rule version metadata update." | |
| exit 0 | |
| fi | |
| scripts/update-next-version.sh --replace "$NEW_VERSION" | |
| # The changeset action does a hard reset, so we need to save | |
| # the changes in a stash so they can be popped later in the `version` command | |
| - name: Stash changes | |
| run: git stash push -u -m __automated-changes | |
| - name: Create Release Pull Request | |
| id: changesets-action | |
| uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3 | |
| with: | |
| version: pnpm run version | |
| commit: "ci: release" | |
| title: "ci: release" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Retrieve version of `@biomejs/biome` and `@biomejs/js-api` | |
| version: | |
| runs-on: depot-ubuntu-24.04-arm-small | |
| needs: changesets | |
| if: needs.changesets.outputs.hasChangesets == 'false' | |
| outputs: | |
| cli-version: ${{ steps.cli-version-changed.outputs.version }} | |
| js-api-version: ${{ steps.js-api-version-changed.outputs.version }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Install Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 24.11.1 | |
| - name: Check CLI version changes | |
| id: cli-version-changed | |
| run: | | |
| version=$(node --experimental-strip-types scripts/version-check.ts packages/@biomejs/biome/package.json) | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - name: Check JS API version changes | |
| id: js-api-version-changed | |
| run: | | |
| version=$(node --experimental-strip-types scripts/version-check.ts packages/@biomejs/js-api/package.json) | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| # Building jobs | |
| build-binaries: | |
| needs: version | |
| if: needs.version.outputs.cli-version | |
| outputs: | |
| version: ${{ needs.version.outputs.cli-version }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: depot-windows-2022-16 | |
| target: x86_64-pc-windows-msvc | |
| code-target: win32-x64 | |
| - os: depot-windows-2022-16 | |
| target: aarch64-pc-windows-msvc | |
| code-target: win32-arm64 | |
| - os: depot-ubuntu-24.04-16 | |
| target: x86_64-unknown-linux-musl | |
| code-target: linux-x64-musl | |
| - os: depot-ubuntu-24.04-arm-16 | |
| target: aarch64-unknown-linux-musl | |
| code-target: linux-arm64-musl | |
| - os: depot-macos-14 | |
| target: x86_64-apple-darwin | |
| code-target: darwin-x64 | |
| - os: depot-macos-14 | |
| target: aarch64-apple-darwin | |
| code-target: darwin-arm64 | |
| name: Package ${{ matrix.code-target }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Install Rust toolchain | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install musl toolchain | |
| if: matrix.code-target == 'linux-x64-musl' || matrix.code-target == 'linux-arm64-musl' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y musl-tools | |
| - name: Install cargo-audit | |
| uses: taiki-e/install-action@f79fe7514db78f0a7bdba3cb6dd9c1baa7d046d9 # v2.62.56 | |
| if: matrix.code-target == 'linux-x64-musl' | |
| with: | |
| tool: cargo-audit | |
| - name: Audit crates.io dependencies | |
| if: matrix.code-target == 'linux-x64-musl' | |
| run: cargo audit | |
| # Build the CLI binary | |
| - name: Build binaries | |
| run: cargo build -p biome_cli --release --target ${{ matrix.target }} | |
| env: | |
| # Strip all debug symbols from the resulting binaries | |
| RUSTFLAGS: "-C strip=symbols -C codegen-units=1" | |
| # Inline the version of the npm package in the CLI binary | |
| BIOME_VERSION: ${{ needs.version.outputs.cli-version }} | |
| # Copy the CLI binary and rename it to include the name of the target platform | |
| - name: Copy CLI binary | |
| if: matrix.os == 'depot-windows-2022-16' | |
| run: | | |
| mkdir dist | |
| cp target/${{ matrix.target }}/release/biome.exe ./dist/biome-${{ matrix.code-target }}.exe | |
| - name: Copy CLI binary | |
| if: matrix.os != 'depot-windows-2022-16' | |
| run: | | |
| mkdir dist | |
| cp target/${{ matrix.target }}/release/biome ./dist/biome-${{ matrix.code-target }} | |
| # Upload the CLI binary as a build artifact | |
| - name: Upload CLI artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: cli-${{ matrix.target }} | |
| path: ./dist/biome-* | |
| if-no-files-found: error | |
| # Build GNU/Linux binaries in Docker, using Debian 11 (bullseye), to support older versions of glibc. | |
| build-binaries-gnu: | |
| needs: version | |
| if: needs.version.outputs.cli-version | |
| env: | |
| RUST_BACKTRACE: 1 | |
| strategy: | |
| matrix: | |
| include: | |
| - os: depot-ubuntu-24.04 | |
| target: x86_64-unknown-linux-gnu | |
| code-target: linux-x64 | |
| - os: depot-ubuntu-24.04-arm-4 | |
| target: aarch64-unknown-linux-gnu | |
| code-target: linux-arm64 | |
| name: Package ${{ matrix.code-target }} | |
| runs-on: ${{ matrix.os }} | |
| container: | |
| image: rust:1.91.1-bullseye@sha256:4886b155a84b46ad61df6a2249905bea8c61fc1eaa903398713233858ff6306b | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Set jemalloc page size for linux-arm64 | |
| if: matrix.code-target == 'linux-arm64' | |
| run: | | |
| echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV | |
| # Build the CLI binary | |
| - name: Build binaries | |
| run: cargo build -p biome_cli --release --target ${{ matrix.target }} | |
| env: | |
| # Strip all debug symbols from the resulting binaries | |
| RUSTFLAGS: "-C strip=symbols -C codegen-units=1" | |
| # Inline the version of the npm package in the CLI binary | |
| BIOME_VERSION: ${{ needs.version.outputs.cli-version }} | |
| # Copy the CLI binary and rename it to include the name of the target platform | |
| - name: Copy CLI binary | |
| run: | | |
| mkdir dist | |
| cp target/${{ matrix.target }}/release/biome ./dist/biome-${{ matrix.code-target }} | |
| # Upload the CLI binary as a build artifact | |
| - name: Upload CLI artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: cli-${{ matrix.target }} | |
| path: ./dist/biome-* | |
| if-no-files-found: error | |
| build-wasm: | |
| name: Build WASM | |
| runs-on: depot-ubuntu-24.04-arm-16 | |
| needs: version | |
| if: needs.version.outputs.cli-version | |
| strategy: | |
| matrix: | |
| include: | |
| - target: wasm-bundler | |
| just-recipe: build-wasm-bundler | |
| - target: wasm-nodejs | |
| just-recipe: build-wasm-node | |
| - target: wasm-web | |
| just-recipe: build-wasm-web | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Install toolchain | |
| uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2 | |
| with: | |
| bins: [email protected], wasm-opt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build WASM module ${{ matrix.target }} | |
| run: just ${{ matrix.just-recipe }} | |
| - name: Upload WASM artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: wasm-artefacts | |
| path: | | |
| ./packages/@biomejs/wasm-bundler | |
| ./packages/@biomejs/wasm-nodejs | |
| ./packages/@biomejs/wasm-web | |
| if-no-files-found: error | |
| build-js-api: | |
| name: Package JavaScript APIs | |
| runs-on: depot-ubuntu-24.04-arm-16 | |
| needs: version | |
| if: needs.version.outputs.js-api-version | |
| outputs: | |
| version: ${{ needs.version.outputs.js-api-version }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Install Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 24.11.1 | |
| - name: Install just | |
| uses: extractions/setup-just@v2 | |
| - name: Install toolchain | |
| uses: moonrepo/setup-rust@ede6de059f8046a5e236c94046823e2af11ca670 # v1.2.2 | |
| with: | |
| bins: [email protected], wasm-opt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache pnpm modules | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.pnpm-store | |
| key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}- | |
| - uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 | |
| - name: Compile backends | |
| run: | | |
| pnpm --filter @biomejs/js-api run build:wasm-bundler | |
| pnpm --filter @biomejs/js-api run build:wasm-node | |
| pnpm --filter @biomejs/js-api run build:wasm-web | |
| pnpm --filter @biomejs/backend-jsonrpc i | |
| pnpm --filter @biomejs/backend-jsonrpc run build | |
| - name: Build package | |
| run: | | |
| pnpm --filter @biomejs/js-api i | |
| pnpm --filter @biomejs/js-api run build | |
| - name: Upload JS API artifact | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: js-api | |
| path: | | |
| ./packages/@biomejs/js-api/dist | |
| if-no-files-found: error | |
| # Publishing jobs | |
| publish-cli: | |
| name: Publish CLI | |
| runs-on: ubuntu-24.04 # Must be a GitHub hosted runner for provenance | |
| needs: | |
| - build-binaries | |
| - build-binaries-gnu | |
| - build-wasm | |
| if: needs.build-binaries.outputs.version | |
| environment: npm-publish | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Download CLI artifacts | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| pattern: cli-* | |
| merge-multiple: true | |
| - name: Download WASM artifacts | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| pattern: wasm-* | |
| merge-multiple: true | |
| path: packages/@biomejs | |
| - name: Install Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 24.11.1 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack | |
| corepack enable | |
| pnpm --version | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate npm packages | |
| run: node packages/@biomejs/biome/scripts/generate-packages.mjs | |
| - name: Publish npm packages as latest | |
| run: for package in packages/@biomejs/*; do if [ $package != "packages/@biomejs/js-api" ] && [ $package != "packages/@biomejs/plugin-api" ]; then npm publish $package --tag latest --access public; fi; done | |
| - name: Publish release for @biomejs/biome | |
| run: | | |
| bash scripts/print-changelog.sh ${{ needs.build-binaries.outputs.version }} >| ${{ github.workspace }}/RELEASE_NOTES | |
| - name: Create GitHub @biomejs/biome release and tag | |
| uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: | | |
| Biome CLI v${{ needs.build-binaries.outputs.version }} | |
| tag_name: | | |
| @biomejs/biome@${{ needs.build-binaries.outputs.version }} | |
| draft: false | |
| body_path: ${{ github.workspace }}/RELEASE_NOTES | |
| files: | | |
| biome-* | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true | |
| - name: Codegen website schema | |
| uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1 | |
| with: | |
| token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }} | |
| repository: ${{ env.BIOME_WEBSITE_REPO }} | |
| event-type: ${{ env.BIOME_RELEASE_CLI_EVENT }} | |
| client-payload: | | |
| { "sha": "${{ github.sha }}", "tag": "@biomejs/biome@${{ needs.build-binaries.outputs.version }}", "version": "${{ needs.build-binaries.outputs.version }}" } | |
| - name: Generate docker images | |
| uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1 | |
| with: | |
| token: ${{ secrets.BIOME_REPOSITORY_DISPATCH }} | |
| repository: ${{ env.BIOME_DOCKER_REPO }} | |
| event-type: ${{ env.BIOME_RELEASE_CLI_EVENT }} | |
| publish-js-api: | |
| name: Publish JS API | |
| runs-on: ubuntu-24.04 # Must be a GitHub hosted runner for provenance | |
| needs: build-js-api | |
| if: needs.build-js-api.outputs.version | |
| environment: npm-publish | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Download JS API artifacts | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: js-api | |
| path: packages/@biomejs/js-api/dist | |
| - name: Install Node.js | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: 24.11.1 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install pnpm | |
| run: | | |
| npm install -g corepack | |
| corepack enable | |
| pnpm --version | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Publish npm package as latest | |
| run: pnpm publish packages/@biomejs/js-api --no-git-checks --tag latest --access public | |
| - name: Publish release for @biomejs/js-api | |
| run: | | |
| bash scripts/print-changelog.sh ${{ needs.build-js-api.outputs.version }} packages/@biomejs/js-api/CHANGELOG.md >| ${{ github.workspace }}/JS_RELEASE_NOTES | |
| - name: Create GitHub @biomejs/js-api release and tag | |
| uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2.4.2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: | | |
| JavaScript APIs v${{ needs.build-js-api.outputs.version }} | |
| tag_name: | | |
| @biomejs/js-api@${{ needs.build-js-api.outputs.version }} | |
| draft: false | |
| body_path: ${{ github.workspace }}/JS_RELEASE_NOTES | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true | |
| make_latest: false # Keep the CLI release as latest |