Release #4
This file contains 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: | |
# Manually released | |
workflow_dispatch: | |
# Every day at midnight (nightly) | |
schedule: | |
- cron: '0 0 * * *' | |
# Uncomment to test in PRs (its safe) | |
# pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
plan: | |
name: Plan release | |
runs-on: ubuntu-latest | |
outputs: | |
publish: ${{ github.event_name == 'workflow_dispatch' }} | |
nightly: ${{ github.event_name == 'schedule' || github.event_name == 'pull_request' }} | |
steps: | |
- run: 'echo "Planning release"' | |
build-binding: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
build: pnpm ci:build-release-binding --target x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
build: | | |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*; | |
export CC=$(xcrun -f clang); | |
export CXX=$(xcrun -f clang++); | |
SYSROOT=$(xcrun --sdk macosx --show-sdk-path); | |
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; | |
export CARGO_BUILD_TARGET=aarch64-apple-darwin; | |
pnpm ci:build-release-binding --target aarch64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
build: pnpm ci:build-release-binding --target x86_64-pc-windows-msvc | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
build: | | |
export CARGO_BUILD_TARGET=i686-pc-windows-msvc; | |
pnpm ci:build-release-binding --target i686-pc-windows-msvc | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
build: | | |
export CARGO_BUILD_TARGET=aarch64-pc-windows-msvc; | |
pnpm ci:build-release-binding --target aarch64-pc-windows-msvc | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
build: | | |
export CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu; | |
export CC=clang; | |
pnpm ci:build-release-binding --target x86_64-unknown-linux-gnu --use-napi-cross | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
build: pnpm ci:build-release-binding --target x86_64-unknown-linux-musl -x | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
build: | | |
export CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu; | |
export CC=clang; | |
pnpm ci:build-release-binding --use-napi-cross --target aarch64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: armv7-unknown-linux-gnueabihf | |
build: | | |
export CARGO_BUILD_TARGET=armv7-unknown-linux-gnueabihf; | |
export CC=clang; | |
pnpm ci:build-release-binding --target armv7-unknown-linux-gnueabihf --use-napi-cross | |
- os: ubuntu-latest | |
target: aarch64-linux-android | |
build: | | |
export CARGO_BUILD_TARGET=aarch64-linux-android; | |
pnpm ci:build-release-binding --target aarch64-linux-android | |
- os: ubuntu-latest | |
target: armv7-linux-androideabi | |
build: | | |
export CARGO_BUILD_TARGET=armv7-linux-androideabi; | |
pnpm ci:build-release-binding --target armv7-linux-androideabi | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
build: | | |
export CARGO_BUILD_TARGET=aarch64-unknown-linux-musl; | |
pnpm ci:build-release-binding -x --target aarch64-unknown-linux-musl | |
name: Build ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: moonrepo/setup-rust@v1 | |
with: | |
cache-base: main | |
- name: Add Rust Target | |
run: rustup target add ${{ matrix.target }} | |
- uses: goto-bus-stop/setup-zig@v2 | |
if: ${{ contains(matrix.target, 'musl') }} | |
with: | |
version: 0.11.0 | |
- uses: taiki-e/install-action@v2 | |
if: ${{ contains(matrix.target, 'musl') }} | |
with: | |
tool: cargo-zigbuild | |
# https://github.com/nodejs/node-gyp/issues/2869 | |
- name: Setup python | |
run: pip install setuptools | |
if: ${{ matrix.os == 'macos-latest' }} | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build Binding | |
run: ${{ matrix.build }} | |
shell: bash | |
- name: Upload Binding Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: bindings-${{ matrix.target }} | |
path: packages/rolldown/src/rolldown-binding.*.node | |
build-node-packages: | |
strategy: | |
fail-fast: false | |
name: Build Node Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build Node Packages | |
# Binaries are built in the previous steps. Unlike in local development, we only need to build the node package itself. | |
run: pnpm --filter rolldown build-node | |
- name: Upload Node Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: node-artifact | |
path: packages/rolldown/dist/** | |
build-wasm: | |
name: Build Wasm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: moonrepo/setup-rust@v1 | |
with: | |
cache-base: main | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build Wasm | |
run: pnpm build-wasm:release | |
- name: Upload Wasm Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: wasm-artifact | |
path: crates/rolldown_binding_wasm/dist/** | |
test: | |
needs: | |
- plan | |
- build-binding | |
- build-wasm | |
- build-node-packages | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-14 | |
target: aarch64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
name: Test ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true # Pull submodules for additional files | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Download Node Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: packages/rolldown/dist | |
name: node-artifact | |
- name: Download Binding Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: packages/rolldown/src | |
name: bindings-${{ matrix.target }} | |
- name: Download Binding Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: packages/rolldown/dist | |
name: bindings-${{ matrix.target }} | |
- name: List rolldown dist | |
run: ls -R ./packages/rolldown | |
shell: bash | |
- name: Node Test | |
run: pnpm test | |
publish: | |
name: Publish npm Packages | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # for softprops/action-gh-release@v1 | |
id-token: write # for `npm publish --provenance` | |
needs: | |
- plan | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install && git reset --hard # fix pnpm install add new line for package.json | |
- name: Download Wasm Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: crates/rolldown_binding_wasm/dist | |
name: wasm-artifact | |
- name: Download Binding Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: packages/rolldown/artifacts | |
- name: Move Binding Artifacts | |
run: pnpm --filter rolldown artifacts | |
- name: List packages | |
run: ls -R ./packages/rolldown/npm | |
shell: bash | |
- name: Download Node Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: packages/rolldown/dist | |
name: node-artifact | |
- name: Prepare publish | |
run: | | |
find ./packages/ -type d -maxdepth 1 -exec cp LICENSE {} \; | |
find ./packages/ -type d -maxdepth 1 -exec cp THIRD-PARTY-LICENSE {} \; | |
echo "//registry.npmjs.org/:_authToken=$ROLLDOWN_NPM_TOKEN" >> ~/.npmrc; | |
git config --global user.email "github-actions[bot]@users.noreply.github.com"; | |
git config --global user.name "github-actions[bot]"; | |
# Only runs when manually dispatched | |
- name: Publish | |
if: ${{ needs.plan.outputs.publish == 'true' }} | |
run: | | |
pnpm changeset version | |
git add --all | |
git commit -m "chore: Release" | |
pnpm changeset publish | |
git push --follow-tags | |
env: | |
NPM_TOKEN: ${{ secrets.ROLLDOWN_NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Only runs for nightly | |
- name: Publish nightly | |
if: ${{ needs.plan.outputs.nightly == 'true' }} | |
run: | | |
pnpm changeset version --snapshot nightly | |
pnpm changeset publish | |
env: | |
NPM_TOKEN: ${{ secrets.ROLLDOWN_NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |