Skip to content

Build Release

Build Release #220

Workflow file for this run

name: Build Release
on:
workflow_dispatch:
inputs:
tag_name:
description: "Optional tag name"
required: false
permissions:
id-token: write # Required for OIDC for publishing to npm
contents: read
jobs:
build-ppx-linux:
strategy:
matrix:
platform: [ubuntu-latest]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
container:
image: debian:bullseye
defaults:
run:
working-directory: packages/rescript-relay/rescript-relay-ppx
steps:
- name: Install system dependencies
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
curl \
ca-certificates \
git \
unzip \
bubblewrap
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 23.x
env:
CI: true
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "4.14"
dune-cache: true
cache-prefix: "v2-bullseye"
- name: Install PPX dependencies
run: opam install . --deps-only
- name: Build PPX
run: |
opam exec -- dune build --profile release-static bin/RescriptRelayPpxApp.exe
- name: Copy built PPX file
run: |
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-linux
- name: Strip binary
run: |
chmod +w ppx-linux
strip ppx-linux
- name: Upload PPX artifact
uses: actions/upload-artifact@v4
with:
name: ppx-linux
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
if-no-files-found: error
build-ppx:
strategy:
matrix:
platform: [
macos-15-intel, # x64
macos-15, # ARM,
windows-latest,
]
name: Build PPX for release
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 23.x
env:
CI: true
- name: Set up OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: "4.14"
dune-cache: true
cache-prefix: "v1"
- name: Install PPX dependencies
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam install . --deps-only
- name: Build PPX
working-directory: packages/rescript-relay/rescript-relay-ppx
run: opam exec -- dune build bin/RescriptRelayPpxApp.exe
- name: Strip PPX binary
if: runner.os != 'Windows'
working-directory: packages/rescript-relay/rescript-relay-ppx
run: |
chmod +w _build/default/bin/RescriptRelayPpxApp.exe
strip _build/default/bin/RescriptRelayPpxApp.exe
- name: Copy built PPX file
working-directory: packages/rescript-relay/rescript-relay-ppx
run: |
cp _build/default/bin/RescriptRelayPpxApp.exe ppx-${{ matrix.platform }}
- name: Upload PPX artifact ${{ matrix.platform }}
uses: actions/upload-artifact@v4
with:
name: ppx-${{ matrix.platform }}
path: packages/rescript-relay/rescript-relay-ppx/ppx-*
if-no-files-found: error
build-compiler:
name: Build Relay Rust Compiler (${{ matrix.target.os }})
strategy:
matrix:
target:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
build-name: relay
artifact-name: relay-compiler-linux-x64
- target: x86_64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-compiler-macos-x64
- target: aarch64-apple-darwin
os: macos-latest
build-name: relay
artifact-name: relay-compiler-macos-arm64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
build-name: relay
artifact-name: relay-compiler-linux-musl
packages: musl-tools
features: vendored
- target: x86_64-pc-windows-msvc
os: windows-latest
build-name: relay.exe
artifact-name: relay-compiler-win-x64
runs-on: ${{ matrix.target.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2025-05-09
override: true
target: ${{ matrix.target.target }}
- name: Install packages
if: matrix.target.os == 'ubuntu-latest' && matrix.target.packages
run: sudo apt update && sudo apt install ${{ matrix.target.packages }} -y
- uses: actions-rs/cargo@v1
with:
command: build
# add --locked back when we have a better way to ensure it's up to date
args: --manifest-path=packages/relay/compiler/Cargo.toml --release --target ${{ matrix.target.target }} ${{ matrix.target.features && '--features' }} ${{ matrix.target.features }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target.artifact-name }}
path: packages/relay/compiler/target/${{ matrix.target.target }}/release/${{ matrix.target.build-name }}
build-release:
name: Build release package
runs-on: ubuntu-latest
needs: [build-ppx, build-ppx-linux, build-compiler]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 23
env:
CI: true
- name: Build assets
env:
INPUT_TAG_NAME: ${{ github.event.inputs.tag_name }}
run: |
./build-ci.sh
- name: Download artifact relay-compiler-linux-x64
uses: actions/[email protected]
with:
name: relay-compiler-linux-x64
path: binaries/relay-compiler-linux-x64
- name: Download artifact relay-compiler-macos-x64
uses: actions/[email protected]
with:
name: relay-compiler-macos-x64
path: binaries/relay-compiler-macos-x64
- name: Download artifact relay-compiler-macos-arm64
uses: actions/[email protected]
with:
name: relay-compiler-macos-arm64
path: binaries/relay-compiler-macos-arm64
- name: Download artifact relay-compiler-linux-musl
uses: actions/[email protected]
with:
name: relay-compiler-linux-musl
path: binaries/relay-compiler-linux-musl
- name: Download artifact relay-compiler-win-x64
uses: actions/[email protected]
with:
name: relay-compiler-win-x64
path: binaries/relay-compiler-win-x64
- uses: actions/[email protected]
with:
name: ppx-linux
path: binaries
- uses: actions/[email protected]
with:
name: ppx-macos-15-intel
path: binaries
- uses: actions/[email protected]
with:
name: ppx-macos-15
path: binaries
- uses: actions/[email protected]
with:
name: ppx-windows-latest
path: binaries
- name: Rename MacOS old binary
run: |
mv binaries/ppx-macos-15-intel binaries/ppx-macos-latest
- name: Rename MacOS ARM64 binary
run: |
mv binaries/ppx-macos-15 binaries/ppx-macos-arm64
- name: Move binaries into release directory
run: |
mv binaries/* _release/
- name: Remove artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
ppx-linux
ppx-macos-15-intel
ppx-macos-15
ppx-windows-latest
relay-compiler-linux-x64
relay-compiler-macos-x64
relay-compiler-win-x64
relay-compiler-macos-arm64
relay-compiler-linux-musl
- name: Upload built folder
uses: actions/upload-artifact@v4
with:
name: release-build
path: _release/
- name: Update npm
run: npm install -g npm@latest
- name: Publish to npm with tag ${{ github.event.inputs.tag_name }}
if: ${{ github.event.inputs.tag_name }}
working-directory: _release
run: npm publish --tag ${{ github.event.inputs.tag_name }}
- name: Publish to npm with tag latest
if: ${{ !github.event.inputs.tag_name }}
working-directory: _release
run: npm publish