Version Packages for Stable Release #1065
Workflow file for this run
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: Release Packages | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - closed | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| publish_and_github_release: | |
| name: Publish Stable and Create GitHub Release | |
| if: > | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'pull_request' && | |
| github.event.action == 'closed' && | |
| github.event.pull_request.merged == true && | |
| (startsWith(github.event.pull_request.title, 'Version Packages for Stable Release') || contains(github.event.pull_request.labels.*.name, 'changeset-release'))) | |
| runs-on: ubuntu-latest-8-core | |
| timeout-minutes: 60 | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=8192" | |
| # needs: [create_version_pr] # This is implied by the trigger conditions | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "npm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: npm ci --prefer-offline | |
| - name: Cache for Turbo | |
| uses: rharkor/caching-for-turbo@v2.3.1 | |
| - name: Store Playwright's Version | |
| run: | | |
| PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | sort | head -n 1) | |
| echo "Playwright's Version: $PLAYWRIGHT_VERSION" | |
| echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV | |
| - name: Cache Playwright Browsers for Playwright's Version | |
| id: cache-playwright-browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }} | |
| - name: Install Playwright Browsers | |
| if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' | |
| run: npx playwright install --with-deps | |
| - name: ensure we can build xmlui and the extensions | |
| run: npm run build-xmlui | |
| - name: run all tests | |
| run: npm run test | |
| - name: Create Version PR or Publish to NPM and Create GitHub Releases | |
| id: changesets_publish | |
| uses: changesets/action@v1 | |
| with: | |
| publish: npm run changeset:publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{secrets.PUBLISH_NPM_TOKEN}} | |
| - name: Output Published Packages Info | |
| if: steps.changesets_publish.outputs.published == 'true' | |
| run: | | |
| echo "Packages published: ${{ steps.changesets_publish.outputs.publishedPackages }}" | |
| - name: Prepare standalone js file | |
| id: prepare_standalone | |
| if: steps.changesets_publish.outputs.published == 'true' && contains(fromJSON(steps.changesets_publish.outputs.publishedPackages).*.name, 'xmlui') | |
| run: | | |
| XMLUI_VERSION=$(jq -r .version xmlui/package.json) | |
| STANDALONE_FILENAME="xmlui-${XMLUI_VERSION}.js" | |
| cp xmlui/dist/standalone/xmlui-standalone.umd.js $STANDALONE_FILENAME | |
| echo "version=$XMLUI_VERSION" >> $GITHUB_OUTPUT | |
| echo "filename=$STANDALONE_FILENAME" >> $GITHUB_OUTPUT | |
| echo "prepared xmlui-standalone.umd.js for release with filename: $STANDALONE_FILENAME" | |
| - name: Upload standalone js file | |
| if: steps.prepare_standalone.outputs.filename != '' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: "${{ steps.prepare_standalone.outputs.filename }}" | |
| tag_name: xmlui@${{ steps.prepare_standalone.outputs.version }} | |
| fail_on_unmatched_files: true | |
| - name: Get VSCode Extension release info | |
| id: xmlui_vscode_info | |
| if: steps.changesets_publish.outputs.published == 'true' | |
| run: | | |
| XMLUI_VSCODE_VERSION=$(jq -r .version tools/vscode/package.json) | |
| XMLUI_VSCODE_TAG="xmlui-vscode@${XMLUI_VSCODE_VERSION}" | |
| echo "tag=$XMLUI_VSCODE_TAG" >> $GITHUB_OUTPUT | |
| XMLUI_VSCODE_TAG_EXISTING=$(git tag --list $XMLUI_VSCODE_TAG) | |
| TAG_EXISTS="false" | |
| if [ ! -z "$XMLUI_VSCODE_TAG_EXISTING" ]; then | |
| TAG_EXISTS="true" | |
| fi | |
| echo "tagExists=$TAG_EXISTS" >> $GITHUB_OUTPUT | |
| echo "current VSCode extension version: $XMLUI_VSCODE_VERSION" | |
| echo "release tag for VSCode extension: $XMLUI_VSCODE_TAG" | |
| echo "tag already exists: $TAG_EXISTS" | |
| - name: Build VSCode extension | |
| if: steps.changesets_publish.outputs.published == 'true' && steps.xmlui_vscode_info.outputs.tagExists == 'false' | |
| run: npm run build-vscode-extension | |
| - name: Upload VSIX to Release | |
| if: steps.changesets_publish.outputs.published == 'true' && steps.xmlui_vscode_info.outputs.tagExists == 'false' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: "tools/vscode/*.vsix" | |
| tag_name: ${{ steps.xmlui_vscode_info.outputs.tag }} | |
| fail_on_unmatched_files: true | |
| - name: Publish VSCode Extension to Marketplace | |
| if: steps.changesets_publish.outputs.published == 'true' && steps.xmlui_vscode_info.outputs.tagExists == 'false' | |
| run: | | |
| cd tools/vscode | |
| npx vsce publish \ | |
| --packagePath *.vsix \ | |
| --no-git-tag-version \ | |
| --no-update-package-json \ | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} |