Skip to content

Turborepo Release

Turborepo Release #1

# Turborepo Release Pipeline
#
# This release consists of a few steps
#
# 1. Create a staging branch
# 2. Run some smoke tests on that branch
# 3. Build the Rust binary
# 4. Publish JS packages npm (including turbo itself)
# 5. Create a release branch and open a PR.
# You can opt into a dry run, which will skip publishing to npm and opening the release branch
name: Turborepo Release
env:
CARGO_PROFILE_RELEASE_LTO: true
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
RELEASE_TURBO_CLI: true # TODO: do we need this?
on:
workflow_dispatch:
inputs:
increment:
description: "SemVer Increment (prerelease = bump canary)"
required: true
default: "prerelease"
type: choice
options:
- prerelease
- prepatch
- preminor
- premajor
- patch
- minor
- major
dry_run:
description: "Do a dry run, skipping the final publish step."
type: boolean
jobs:
stage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
with:
enable-corepack: false
- name: Configure git
run: |
git config --global user.name 'Turbobot'
git config --global user.email 'turbobot@vercel.com'
- name: Version
run: |
./scripts/version.js ${{ inputs.increment }}
cat version.txt
- name: Stage Commit
id: stage
run: cd cli && make stage-release && echo "STAGE_BRANCH=$(git branch --show-current)" >> $GITHUB_OUTPUT
- name: Show Stage Commit
run: echo "${{ steps.stage.outputs.STAGE_BRANCH }}"
outputs:
stage-branch: "${{ steps.stage.outputs.STAGE_BRANCH }}"
rust-smoke-test:
name: Rust Unit Tests
runs-on: ubuntu-latest
needs: [stage]
steps:
- name: Show Stage Commit
run: echo "${{ needs.stage.outputs.stage-branch }}"
- uses: actions/checkout@v3
with:
ref: ${{ needs.stage.outputs.stage-branch }}
- name: Setup Turborepo Environment
uses: ./.github/actions/setup-turborepo-environment
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Run Rust Unit Tests
run: cargo groups test turborepo
js-smoke-test:
name: JS Package Tests
runs-on: ubuntu-latest
needs: [stage]
steps:
- name: Show Stage Commit
run: echo "${{ needs.stage.outputs.stage-branch }}"
- uses: actions/checkout@v3
with:
ref: ${{ needs.stage.outputs.stage-branch }}
- name: Setup Turborepo Environment
uses: ./.github/actions/setup-turborepo-environment
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
node-version: "20"
- name: Install Global Turbo
uses: ./.github/actions/install-global-turbo
- name: Run JS Package Tests
run: turbo run check-types test --filter="./packages/*" --color
create-release-pr:
name: "Open Release Branch PR"
needs: [stage, js-smoke-test, rust-smoke-test]
runs-on: ubuntu-latest
steps:
- name: Show Stage Commit
run: echo "${{ needs.stage.outputs.stage-branch }}"
- uses: actions/checkout@1.0.0
with:
ref: ${{ needs.stage.outputs.stage-branch }}
- name: Get version
id: getVersion
run: echo "version=$(head -n 1 version.txt)" >> $GITHUB_OUTPUT
- name: Create pull request
uses: thomaseizinger/create-pull-request@master
if: ${{ !inputs.dry_run }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
head: ${{ needs.stage.outputs.stage-branch }}
base: main
title: "release(turborepo): ${{ steps.getVersion.outputs.version }}"