Fixes to nested flows and flyde-nodes.json + website journey fixes (#… #513
This file contains hidden or 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: Build, Test, Lint | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-test-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - uses: pnpm/action-setup@v4 | |
| name: Install pnpm | |
| id: pnpm-install | |
| with: | |
| version: 10.12.4 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - uses: actions/cache@v4 | |
| name: Setup pnpm cache | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Lint | |
| run: pnpm run lint | |
| - name: Build | |
| run: pnpm run build | |
| env: | |
| NEXT_PUBLIC_SUPABASE_URL: ${{ vars.NEXT_PUBLIC_SUPABASE_URL }} | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} | |
| - name: Test | |
| run: xvfb-run -a pnpm run test | |
| env: | |
| SKIP_VISUAL_TESTS: true | |
| - name: If release, Publish to NPM | |
| if: github.ref == 'refs/heads/main' && (startsWith(github.event.head_commit.message, 'Prepare for v') || startsWith(github.event.head_commit.message, 'Prepare for v1.0.0-alpha')) | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| if [ -z "$NODE_AUTH_TOKEN" ]; then | |
| echo "Error: NPM_TOKEN is not set" | |
| exit 1 | |
| fi | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "github-actions@users.noreply.github.com" | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
| root_dir=$(pwd) | |
| for package in $(pnpm list --json --only-projects -r | jq -c '.[]'); do | |
| name=$(echo $package | jq -r '.name') | |
| path=$(echo $package | jq -r '.path') | |
| cd "$path" | |
| is_private=$(echo $package | jq '.private') | |
| if [[ "$is_private" == "true" ]]; then | |
| echo "Skipping private package: $name" | |
| cd "$root_dir" | |
| continue | |
| fi | |
| if [[ "$name" == "website" || "$name" == "flyde-vscode" ]]; then | |
| echo "Skipping package: $name" | |
| cd "$root_dir" | |
| continue | |
| fi | |
| # Dry run first to validate | |
| echo "Validating package: $name" | |
| if [[ $(grep -o '"version": "1.0.0-alpha' package.json) ]]; then | |
| pnpm publish --dry-run --access public --no-git-checks --tag alpha || { | |
| echo "Dry run failed for $name" | |
| cd "$root_dir" | |
| continue | |
| } | |
| else | |
| pnpm publish --dry-run --access public --no-git-checks || { | |
| echo "Dry run failed for $name" | |
| cd "$root_dir" | |
| continue | |
| } | |
| fi | |
| # Actual publish | |
| if [[ $(grep -o '"version": "1.0.0-alpha' package.json) ]]; then | |
| echo "Publishing alpha version of $name" | |
| pnpm publish --access public --force --no-git-checks --tag alpha | |
| else | |
| # Check if version already exists for non-alpha versions | |
| current_version=$(grep -o '"version": "[^"]*"' package.json | cut -d'"' -f4) | |
| if npm view $name@$current_version > /dev/null 2>&1; then | |
| echo "Version $current_version of $name already exists, skipping" | |
| else | |
| echo "Publishing $name version $current_version" | |
| pnpm publish --access public --force --no-git-checks | |
| fi | |
| fi | |
| echo "Published $name\n\n" | |
| cd "$root_dir" | |
| done |