Turborepo Library Release #45
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: Turborepo Library Release | |
on: | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: "Do a dry run, skipping the final publish step." | |
type: boolean | |
jobs: | |
build: | |
defaults: | |
run: | |
shell: bash -leo pipefail {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: "aarch64-apple-darwin" | |
- host: macos-latest | |
target: "x86_64-apple-darwin" | |
- host: ubuntu-latest | |
target: "aarch64-unknown-linux-gnu" | |
setup: | | |
sudo apt update | |
sudo apt install -y crossbuild-essential-arm64 | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
- host: ubuntu-latest | |
target: "x86_64-unknown-linux-gnu" | |
- host: ubuntu-latest | |
target: "x86_64-unknown-linux-musl" | |
setup: | | |
sudo apt update | |
sudo apt install -y musl-tools | |
- host: ubuntu-latest | |
target: "aarch64-unknown-linux-musl" | |
setup: | | |
sudo apt update | |
sudo apt install -y crossbuild-essential-arm64 musl-tools clang llvm | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CC_aarch64_unknown_linux_musl=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CXX_aarch64_unknown_linux_musl=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
rust_env: 'RUSTFLAGS="-Ctarget-feature=-crt-static"' | |
- host: windows-latest | |
target: "aarch64-pc-windows-msvc" | |
- host: windows-latest | |
target: "x86_64-pc-windows-msvc" | |
name: "Build ${{ matrix.settings.target }}" | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Rust | |
uses: ./.github/actions/setup-rust | |
with: | |
targets: ${{ matrix.settings.target }} | |
- name: Setup Node | |
uses: ./.github/actions/setup-node | |
- name: Setup toolchain | |
shell: bash | |
run: ${{ matrix.settings.setup }} | |
if: ${{ matrix.settings.setup }} | |
- name: Build native library | |
shell: bash | |
run: | | |
cd packages/turbo-repository | |
${{ matrix.settings.rust_env }} pnpm build:release --target=${{ matrix.settings.target }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: turbo-library-${{ matrix.settings.target }} | |
path: packages/turbo-repository/native | |
package: | |
name: "Publish to NPM" | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure git | |
run: | | |
git config --global user.name 'Turbobot' | |
git config --global user.email '[email protected]' | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: native-packages | |
- name: Move artifacts into place | |
run: | | |
mv native-packages/turbo-library-aarch64-apple-darwin/@turbo/repository.darwin-arm64.node packages/turbo-repository/npm/darwin-arm64/ | |
mv native-packages/turbo-library-x86_64-apple-darwin/@turbo/repository.darwin-x64.node packages/turbo-repository/npm/darwin-x64/ | |
mv native-packages/turbo-library-aarch64-unknown-linux-gnu/@turbo/repository.linux-arm64-gnu.node packages/turbo-repository/npm/linux-arm64-gnu/ | |
mv native-packages/turbo-library-aarch64-unknown-linux-musl/@turbo/repository.linux-arm64-musl.node packages/turbo-repository/npm/linux-arm64-musl/ | |
mv native-packages/turbo-library-x86_64-unknown-linux-gnu/@turbo/repository.linux-x64-gnu.node packages/turbo-repository/npm/linux-x64-gnu/ | |
mv native-packages/turbo-library-x86_64-unknown-linux-musl/@turbo/repository.linux-x64-musl.node packages/turbo-repository/npm/linux-x64-musl/ | |
mv native-packages/turbo-library-aarch64-pc-windows-msvc/@turbo/repository.win32-arm64-msvc.node packages/turbo-repository/npm/win32-arm64-msvc/ | |
mv native-packages/turbo-library-x86_64-pc-windows-msvc/@turbo/repository.win32-x64-msvc.node packages/turbo-repository/npm/win32-x64-msvc/ | |
- name: Build Meta Package | |
run: | | |
cd packages/turbo-repository/js | |
npm run build | |
- name: Package Artifacts | |
run: | | |
mkdir tarballs | |
npm pack packages/turbo-repository/npm/darwin-arm64 | |
npm pack packages/turbo-repository/npm/darwin-x64 | |
npm pack packages/turbo-repository/npm/linux-arm64-gnu | |
npm pack packages/turbo-repository/npm/linux-arm64-musl | |
npm pack packages/turbo-repository/npm/linux-x64-gnu | |
npm pack packages/turbo-repository/npm/linux-x64-musl | |
npm pack packages/turbo-repository/npm/win32-arm64-msvc | |
npm pack packages/turbo-repository/npm/win32-x64-msvc | |
npm pack packages/turbo-repository/js | |
mv *.tgz tarballs/ | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Upload Tarballs | |
path: tarballs | |
- name: Publish Artifacts | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
if: ${{ !inputs.dry_run }} | |
run: | | |
npm config set --location=project "//registry.npmjs.org/:_authToken" ${NPM_TOKEN} | |
VERSION=$(jq -r .version packages/turbo-repository/js/package.json) | |
cd tarballs | |
ls | |
TAG="canary" | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-darwin-arm64-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-darwin-x64-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-arm64-gnu-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-arm64-musl-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-x64-gnu-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-linux-x64-musl-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-win32-arm64-msvc-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-win32-x64-msvc-${VERSION}.tgz | |
npm publish -ddd --tag ${TAG} --access public turbo-repository-${VERSION}.tgz |