Skip to content

🚀 Release packages #139

🚀 Release packages

🚀 Release packages #139

Workflow file for this run

name: 🚀 Release packages
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to release'
required: true
default: 'main'
dry_run:
type: boolean
description: 'Run the workflow in dry-run mode'
required: false
default: false
npm_tag:
type: choice
description: 'Specify npm tag'
required: true
default: 'alpha'
options:
- alpha
- beta
- rc
- canary
- latest
extension_type:
type: choice
description: 'Specify the release type of extension'
required: true
default: pre-release
options:
- official
- pre-release
to_release:
description: 'Packages to release'
type: choice
required: true
options:
- all
- npm
- extension
permissions:
contents: read
jobs:
publish-npm:
if: ${{ inputs.to_release == 'all' || inputs.to_release == 'npm' }}
name: ${{ inputs.dry_run == true && 'Dry Run - NPM Packages' || 'Publish NPM Packages' }}
needs: [build, napi-build]
runs-on: ubuntu-22.04
environment: release
permissions:
# For push git tags
contents: write
# For Trusted Publish
id-token: write
steps:
- name: Show dry-run status
run: |
if [ "${{ inputs.dry_run }}" = "true" ]; then
echo "🏃‍♂️ RUNNING IN DRY-RUN MODE - No packages will be published to npm registry"
echo "=================================================="
else
echo "🚀 LIVE MODE - Packages will be published to npm registry"
echo "========================================"
fi
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '24'
# Update npm to the latest version to enable OIDC
- name: Update npm
run: |
npm install -g npm@latest
npm --version
- name: Install pnpm
run: corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download Artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: binaries
- name: Move binaries
uses: ./.github/actions/move-artifacts
# The per-platform .node parser binaries ship in the @rslint/native-{tuple}
# subpackages, populated from the napi-build artifacts by move-artifacts
# above. core's loader resolves them at runtime, so no napi build / Rust is
# needed here — build:js just bundles the worker (loader + types live in core).
- name: Build @rslint/core dist
run: pnpm --filter @rslint/core build:js
- name: Publish npm packages
if: ${{ inputs.dry_run == false }}
run: |
pnpm -r publish --no-git-checks --tag ${{ github.event.inputs.npm_tag }} --publish-branch ${{ github.event.inputs.branch }}
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions"
version=$(jq -r .version package.json)
git tag v$version -m "v$version"
git push origin v$version
publish-extension-vscode:
if: ${{ inputs.to_release == 'all' || inputs.to_release == 'extension' }}
name: ${{ inputs.dry_run == true && 'Dry Run - VSCode Extensions' || 'Publish VSCode Extensions' }}
# napi-build supplies the per-platform parser `.node` (downloaded into
# `binaries/native-<tuple>/`) that publish-marketplace.mjs stages into the
# eslint-plugin worker payload; without it the packaged plugin host can't load.
needs: [build, napi-build]
runs-on: rspack-ubuntu-22.04-large
environment: release
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Download Artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: binaries
- name: Build and publish to Microsoft VS Code Marketplace
env:
VSCE_PAT: ${{ secrets.RSLINT_VSCE_PAT }}
run: |
if [ "${{ inputs.dry_run }}" = "true" ]; then
echo "🚀 DRY RUN: Building and packaging VS Code extension without publishing..."
if [ "${{ inputs.extension_type }}" = "pre-release" ]; then
pnpm publish:vsce --prerelease --dry-run
else
pnpm publish:vsce --dry-run
fi
else
if [ "${{ inputs.extension_type }}" = "pre-release" ]; then
pnpm publish:vsce --prerelease
else
pnpm publish:vsce
fi
fi
- name: Upload VSCE artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
path: packages/vscode-extension/rslint-*.vsix
publish-extension-open-vsx:
if: ${{ inputs.to_release == 'all' || inputs.to_release == 'extension' }}
name: ${{ inputs.dry_run == true && 'Dry Run - Open VSX Extensions' || 'Publish Open VSX Extensions' }}
# Same as publish-extension-vscode: needs the per-platform parser `.node`.
needs: [build, napi-build]
runs-on: ubuntu-22.04
environment: release
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Download Artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: binaries
- name: Build and publish to Open VSX Registry
env:
OVSX_PAT: ${{ secrets.RSLINT_OVSX_PAT }}
run: |
if [ "${{ inputs.dry_run }}" = "true" ]; then
echo "🚀 DRY RUN: Building and packaging for Open VSX Registry without publishing..."
if [ "${{ inputs.extension_type }}" = "pre-release" ]; then
pnpm publish:ovsx --prerelease --dry-run
else
pnpm publish:ovsx --dry-run
fi
else
if [ "${{ inputs.extension_type }}" = "pre-release" ]; then
pnpm publish:ovsx --prerelease
else
pnpm publish:ovsx
fi
fi
check:
name: Test
if: ${{ inputs.dry_run == false }}
needs: [build]
strategy:
fail-fast: true
matrix:
include:
- goos: linux
goarch: amd64
node_arch: x64
node_os: linux
runs-on: rspack-ubuntu-22.04-large
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '24'
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go-version: 1.26.0
cache-name: ${{ matrix.node_os }}-${{ matrix.node_arch }}
- name: Install pnpm
run: corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download Artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: binaries
- name: Move binaries
uses: ./.github/actions/move-artifacts
- name: Format code
run: pnpm format:check
# napi build drops the host .node into its @rslint/native-{tuple} package;
# the Test step's worker loads it at runtime.
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
cache: 'false'
- name: Build napi parser (native)
run: pnpm --filter @rslint/native build
- name: Build
run: pnpm run build
- name: TypeCheck
run: pnpm typecheck
- name: Lint code
run: pnpm lint
- name: Install xvfb and dependencies
if: ${{ runner.os == 'Linux' && runner.environment == 'self-hosted' }}
run: |
sudo apt-get update
sudo apt-get install -y xvfb libxss1 libgtk-3-0 libgconf-2-4 libnss3 libxrandr2 libasound2 libpangocairo-1.0-0 libatk1.0-0 libcairo-gobject2 libgtk-3-0 libgdk-pixbuf2.0-0
- name: Test on Linux
run: xvfb-run -a npm run test
build:
env:
GOMAXPROCS: 8
name: Build-Binaries
strategy:
fail-fast: false
matrix:
include:
- goos: darwin
goarch: amd64
node_arch: x64
node_os: darwin
- goos: darwin
goarch: arm64
node_arch: arm64
node_os: darwin
- goos: linux
goarch: amd64
node_arch: x64
node_os: linux
- goos: linux
goarch: arm64
node_arch: arm64
node_os: linux
- goos: windows
goarch: amd64
node_arch: x64
node_os: win32
- goos: windows
goarch: arm64
node_arch: arm64
node_os: win32
runs-on: rspack-ubuntu-22.04-large
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '24'
- name: Setup Go
uses: ./.github/actions/setup-go
with:
go-version: 1.26.0
cache-name: ${{ matrix.node_os }}-${{ matrix.node_arch }}
- name: Setup Rust
uses: ./.github/actions/setup-rust
- name: Install pnpm
run: corepack enable
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Go Build rslint
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o ${{ matrix.node_os }}-${{ matrix.node_arch }}-rslint ./cmd/rslint
- name: Go Build tsgo
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o ${{ matrix.node_os }}-${{ matrix.node_arch }}-tsgo ./cmd/tsgo
- name: Upload rslint artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ matrix.node_os }}-${{ matrix.node_arch }}-rslint
path: ${{ matrix.node_os }}-${{ matrix.node_arch }}-rslint
- name: Upload tsgo artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ matrix.node_os }}-${{ matrix.node_arch }}-tsgo
path: ${{ matrix.node_os }}-${{ matrix.node_arch }}-tsgo
- name: Build typescript-go
run: |
cd typescript-go
npm ci
npm run build
# Remove tsgo binary from typescript-go build, we use our own ./cmd/tsgo build
rm -f built/local/tsgo built/local/tsgo.exe
- name: Upload typescript-go built artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ matrix.node_os }}-${{ matrix.node_arch }}-tsgo-built
path: typescript-go/built
# napi `.node` parser binaries, one per target → the @rslint/native-{tuple}
# subpackages. Separate matrix from the Go build job (which is ubuntu-only):
# napi win32-msvc/darwin need native runners since zig and
# @napi-rs/cross-toolchain can't target windows-msvc. Each leg uploads a
# uniquely-named artifact (`native-{tuple}` — upload-artifact@v4 rejects
# dupes); move-artifacts matches the `rslint.` filename prefix. gnu cross
# legs use --use-napi-cross (@napi-rs/cross-toolchain, gnu-only); musl uses
# -x (cargo-zigbuild) since cross-toolchain has no musl sysroot.
napi-build:
name: Build napi (${{ matrix.settings.target }})
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: aarch64-apple-darwin
artifact: native-darwin-arm64
- host: macos-latest
target: x86_64-apple-darwin
artifact: native-darwin-x64
- host: windows-latest
target: x86_64-pc-windows-msvc
artifact: native-win32-x64-msvc
- host: windows-latest
target: aarch64-pc-windows-msvc
artifact: native-win32-arm64-msvc
- host: rspack-ubuntu-22.04-large
target: x86_64-unknown-linux-gnu
artifact: native-linux-x64-gnu
- host: rspack-ubuntu-22.04-large
target: aarch64-unknown-linux-gnu
artifact: native-linux-arm64-gnu
cross: '--use-napi-cross'
- host: rspack-ubuntu-22.04-large
target: x86_64-unknown-linux-musl
artifact: native-linux-x64-musl
cross: '-x'
- host: rspack-ubuntu-22.04-large
target: aarch64-unknown-linux-musl
artifact: native-linux-arm64-musl
cross: '-x'
runs-on: ${{ matrix.settings.host }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}
submodules: true
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '24'
- name: Install pnpm
run: corepack enable
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
targets: ${{ matrix.settings.target }}
cache-key: ${{ matrix.settings.target }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
# musl legs cross-compile via cargo-zigbuild (napi -x); zig must be on
# PATH (@napi-rs/cli auto-installs cargo-zigbuild when missing, but not
# zig itself).
- name: Setup zig (musl cross-compile)
if: ${{ contains(matrix.settings.target, 'musl') }}
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
- name: Build napi
run: pnpm --filter @rslint/native exec napi build --platform --release --no-js --target ${{ matrix.settings.target }} ${{ matrix.settings.cross || '' }}
- name: Upload napi artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ matrix.settings.artifact }}
path: crates/rslint-native/rslint.*.node
if-no-files-found: error