Skip to content

Fix await loop situation where we're waiting for a pending run, but p… #61

Fix await loop situation where we're waiting for a pending run, but p…

Fix await loop situation where we're waiting for a pending run, but p… #61

Workflow file for this run

name: Release
on:
push:
branches: [main, release-**]
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
release:
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v2.x
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: pnpm/action-setup@v4
with:
version: 10.13.1
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Publish snapshot
if: github.ref == 'refs/heads/main'
run: |
# We're using 0.0.0 to avoid this version to be higher than released versions.
# To use it:
# "@restatedev/restate-sdk": "^0.0.0-SNAPSHOT"
VERSION="0.0.0-SNAPSHOT-$(date '+%Y%m%d%H%M%S')"
# Update all lib package versions using jq
for pkg in packages/libs/*/package.json; do
jq --arg ver "$VERSION" '.version = $ver' "$pkg" > "$pkg.tmp" && mv "$pkg.tmp" "$pkg"
done
# Update workspace protocol dependencies to use the snapshot version
pnpm install --no-frozen-lockfile
# We use dist-tag dev for the snapshot releases, see https://docs.npmjs.com/cli/v9/commands/npm-dist-tag for more info
# A snapshot MUST not be published with latest tag (omitting --tag defaults to latest) to avoid users to install snapshot releases
# when using pnpm install
pnpm --filter "./packages/libs/**" publish --tag dev --access public --no-git-checks --provenance
git checkout .
- name: Check for new version
id: check
run: |
git fetch --tags
for package in packages/libs/*/package.json; do
if [ -f "$package" ]; then
NAME=$(jq -r '.name' "$package")
VERSION=$(jq -r '.version' "$package")
PRIVATE=$(jq -r '.private // false' "$package")
if [ "$PRIVATE" = "false" ]; then
if ! git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "New version detected: $NAME@$VERSION"
echo "create_release=true" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
break
fi
fi
fi
done
- name: Create and Push Tag
if: steps.check.outputs.create_release == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "v${{ steps.check.outputs.version }}"
git push origin "v${{ steps.check.outputs.version }}"
- name: Create Release
if: steps.check.outputs.create_release == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "v${{ steps.check.outputs.version }}" \
--title "Release v${{ steps.check.outputs.version }}" \
--generate-notes
- name: Publish release to npm
if: steps.check.outputs.create_release == 'true'
run: pnpm -r --filter='./packages/libs/**' publish --access public --no-git-checks --provenance