Files
triggerdotdev--trigger.dev/scripts/publish-prerelease.sh
T
nicktrn 2b586c87a0 Fix controller waitpoint resolution, suspendable state, and snapshot race conditions (#2006)
* remove dead code

* rename managed to shared runtime manager

* rename to resolve waitpoint for clarity

* add resolver id helper

* store and correctly resolve waipoints that come in early

* fix ipc message type change

* branded type for resolver ids

* add fixme comments

* remove more unused ipc schemas

* fix entitlement validation when client doesn't exist

* restore hello world reference workspace imports

* runtime manager debug logs

* prefix engine run logs

* managed run logger accepts nested props

* runtime suspendable state and improved logs

* require suspendable state for checkpoints, fix snapshot processing queue

* add terminal link as cli module so we can more easily patch it

* apply cursor patch

* add license info

* remove terminal-link package and add deprecation notice

* remove old patch

* remove terminal-link from sdk

* rename snapshot module

* add cli test tsconfig

* add run logger base type

* add snapshot manager tests

* fix cli builds

* improve QUEUED_EXECUTING test

* changeset

* make testcontainers wait until container has stopped

* require unit tests for publishing again

* avoid mutation during iteration when resolving pending waitpoints

* improve debug logs and make them less noisy

* always update poller snapshot id for accurate logs

* detach task run process handlers

* check for env overrides in a few more places and add verbose logs

* log when poller is still executing when we stop it

* add supervisor to publish workflow

* always print full deploy logs in CI

* Revert "avoid mutation during iteration when resolving pending waitpoints"

This reverts commit 87b0ce1e5b.

* disable pre

* print prerelease script errors

* Revert "disable pre"

This reverts commit 9403409637.

* misc fixes

* better debug logs

* add snapshots since methods and route

* prep for snapshots since

* improve deprecated execution detection

* update supervisor and schema

* properly log http server errors

* detect restore after failed snapshot fetch

* run and snapshot id can be overridden

* fix restore detection

* fix deprecation checks, move into snapshot manager

* less logs

* rename snapshot manager stop

* restore detection was moved into snapshot manager

* fix notifier logs

* make runtime manager status a debug log

* no need to attach runtime status twice

* findUnique -> findFirst

* sort snapshots by created at everywhere
2025-05-07 13:02:32 +01:00

82 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
set -e
# Function to extract GITHUB_TOKEN from .env file
extract_github_token() {
if [ -f .env ]; then
token=$(grep -E '^GITHUB_TOKEN=' .env | sed 's/^GITHUB_TOKEN=//' | sed 's/^"//' | sed 's/"$//')
if [ ! -z "$token" ]; then
export GITHUB_TOKEN="$token"
else
echo "GITHUB_TOKEN not found in .env file."
return 1
fi
else
echo "GITHUB_TOKEN not found in .env file."
return 1
fi
}
# Check if GITHUB_TOKEN is already set
if [[ -z "${GITHUB_TOKEN}" ]]; then
extract_github_token || exit 1
fi
# Use the first argument as version or 'v3-prerelease' if not available
version=${1:-'v3-prerelease'}
# Ensure git stage is clear
if [[ $(git status --porcelain) ]]; then
echo "Your git status is not clean. Please commit your changes before running this script.";
echo "To reset all your changes, run this instead: git reset --hard HEAD"
exit 1;
else
echo "Git status is clean. Proceeding with the script.";
fi
# From here on, if the user aborts the script, we will clean up the git stage
git_reset() {
git reset --hard HEAD
}
abort() {
echo "Aborted. Cleaning up..."
git_reset
exit 1
}
trap abort INT
# Run your commands
# Run changeset version command and capture its output
echo "Running: pnpm exec changeset version --snapshot $version"
if output=$(pnpm exec changeset version --snapshot $version 2>&1); then
if echo "$output" | grep -q "No unreleased changesets found"; then
echo "No unreleased changesets found. Exiting."
exit 0
fi
else
echo "$output"
echo "Error running changeset version command, detailed output above"
exit 1
fi
read -e -p "Pausing for manual changes, press Enter when ready to continue..."
echo "Running: pnpm run clean --filter \"@trigger.dev/*\" --filter \"trigger.dev\""
pnpm run clean --filter "@trigger.dev/*" --filter "trigger.dev"
echo "Running: pnpm run build --filter \"@trigger.dev/*\" --filter \"trigger.dev\""
pnpm run build --filter "@trigger.dev/*" --filter "trigger.dev"
echo "Going to run: pnpm exec changeset publish --no-git-tag --snapshot --tag $version"
read -p "Do you wish to continue? (y/N): " prompt
if [[ $prompt =~ [yY](es)* ]]; then
pnpm exec changeset publish --no-git-tag --snapshot --tag $version
else
abort
fi
# If there were no errors, clear the git stage
echo "Commands ran successfully. Clearing the git stage."
git_reset