Feat/research (#217) #907
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
| # v2.2.0 | |
| name: Virto-shell CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main, feat/virto-oz ] | |
| # Only on commits with package changes or release commits | |
| paths: | |
| - 'framework/**' | |
| - 'cli/**' | |
| - 'configs/**' | |
| - '**/package.json' | |
| - '**/CHANGELOG.md' | |
| release: | |
| types: [published] | |
| jobs: | |
| CI: | |
| runs-on: ubuntu-latest | |
| # Only runs on release commits, releases, or manual dispatch | |
| if: | | |
| github.event_name == 'release' || | |
| github.event_name == 'workflow_dispatch' || | |
| contains(github.event.head_commit.message, 'release:') || | |
| contains(github.event.head_commit.message, 'chore: release') | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
| VERSION_SUFFIX: '' | |
| ARTIFACT_URL: '' | |
| GITHUB_USER: '${{ github.repository_owner }}' | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NPM_TAG: 'latest' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Setup .npmrc file to publish to GitHub Packages | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| always-auth: true | |
| - name: Set GITHUB_USER to lowercase | |
| run: | | |
| echo "GITHUB_USER=${GITHUB_USER,,}" >> $GITHUB_ENV | |
| - name: Install dependencies | |
| run: | | |
| yarn install | |
| env: | |
| YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
| - name: Get Image Version | |
| uses: VirtoCommerce/vc-github-actions/get-image-version@master | |
| id: image | |
| with: | |
| projectType: theme | |
| - name: Set release variables | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| run: | | |
| echo "VERSION_SUFFIX=${{ steps.image.outputs.prefix }}" >> $GITHUB_ENV | |
| - name: Set release-alpha variables | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| run: | | |
| echo "VERSION_SUFFIX=${{ steps.image.outputs.fullVersion }}" >> $GITHUB_ENV | |
| - name: Set PR variables | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| echo "VERSION_SUFFIX=${{ steps.image.outputs.taggedVersion }}" >> $GITHUB_ENV | |
| - name: Build virto-shell | |
| run: | | |
| yarn build | |
| - name: Configure npm | |
| if: success() | |
| run: | | |
| echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Clean git state | |
| if: success() | |
| run: | | |
| # Reset any changes to yarn.lock that might have occurred during install | |
| git checkout -- yarn.lock || true | |
| # Ensure clean working directory for Lerna | |
| git status --porcelain | |
| - name: Determine npm tag | |
| if: success() | |
| run: | | |
| VERSION=$(node -p "require('./framework/package.json').version") | |
| NPM_TAG=$(node -e "const m='$VERSION'.match(/-(alpha|beta|rc|next)/); console.log(m?m[1]:'latest')") | |
| echo "Version: $VERSION → npm tag: $NPM_TAG" | |
| echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV | |
| - name: Publish with Lerna | |
| if: success() | |
| run: | | |
| echo "Publishing packages with Lerna using tag: $NPM_TAG" | |
| # Lerna automatically: | |
| # - Detects changed packages from package.json | |
| # - Uses the specified npm tag for all packages | |
| # - Handles dependencies between packages | |
| # - Excludes private packages and root package | |
| npx lerna publish from-package --yes --no-git-reset --no-private --npm-tag="$NPM_TAG" | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Verify npm dist tags | |
| if: success() | |
| run: | | |
| echo "Verifying npm dist tags..." | |
| echo "Published packages with tag: $NPM_TAG" | |
| # Show current tags for verification | |
| PACKAGES=( | |
| "@vc-shell/framework" | |
| "@vc-shell/ts-config" | |
| "@vc-shell/release-config" | |
| "@vc-shell/create-vc-app" | |
| "@vc-shell/config-generator" | |
| "@vc-shell/api-client-generator" | |
| ) | |
| for PACKAGE in "${PACKAGES[@]}"; do | |
| echo "Tags for $PACKAGE:" | |
| npm dist-tag ls "$PACKAGE" 2>/dev/null || echo "Package not found in npm" | |
| echo "---" | |
| done | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| Storybook: | |
| needs: 'CI' | |
| uses: VirtoCommerce/vc-shell/.github/workflows/storybook-ci.yml@main | |
| with: | |
| event_name: ${{ github.event_name }} | |
| secrets: | |
| VCMP_PLATFORM_TOKEN: ${{ secrets.VCMP_PLATFORM_TOKEN }} |