From ac626a8b5090bf9d3c14dbd15c8be29e1a8cb3d8 Mon Sep 17 00:00:00 2001 From: Muhammad Ali Date: Mon, 13 Oct 2025 12:41:02 +0500 Subject: [PATCH 1/2] feat: create ESM bundle, and upload to assets manager --- .github/workflows/publish-on-release.yml | 56 +++++++++++++++++++++--- guides/release-process.md | 1 + 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml index ab8b53b6a..367af8270 100644 --- a/.github/workflows/publish-on-release.yml +++ b/.github/workflows/publish-on-release.yml @@ -5,8 +5,8 @@ on: types: [published] jobs: - build: - name: Build Vanilla + build-css: + name: Build Vanilla CSS runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -16,7 +16,7 @@ jobs: - name: Read Vanilla version from package.json run: | node -p "require('./package.json').version" > VANILLA_VERSION - echo "Building Vanilla v$(cat VANILLA_VERSION)" + echo "Building Vanilla CSS v$(cat VANILLA_VERSION)" - run: yarn install - run: yarn build - run: yarn test @@ -28,6 +28,46 @@ jobs: name: css path: build/css + build-js: + name: Build Vanilla JS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Read Vanilla version from package.json + run: | + node -p "require('./package.json').version" > VANILLA_VERSION + echo "Building Vanilla JS v$(cat VANILLA_VERSION)" + - name: Install esbuild and dependencies + run: npm install esbuild + - name: Create esbuild configuration file + # This step creates a script to execute your specific esbuild configuration + run: | + echo 'require("esbuild").build({ + entryPoints: ["templates/static/js/index.js"], + bundle: true, + outfile: "build/js/vanilla.bundle.mjs", + format: "esm", + sourcemap: true, + minify: true, + tsconfigRaw: {}, + });' > esbuild-config.js + - name: Run esbuild to generate ESM bundle + run: node esbuild-config.js + - name: Show size of the build file + run: stat -c '%s' build/js/vanilla.bundle.mjs + - run: cp VANILLA_VERSION build/js + - uses: actions/upload-artifact@v4 + with: + name: js + path: build/js/vanilla.bundle.mjs + build: + name: Build Vanilla CSS and JS + runs-on: ubuntu-latest + needs: [build-css, build-js] + publish-npm: name: Publish to NPM needs: build @@ -60,11 +100,13 @@ jobs: path: css - name: Install upload-assets snap run: sudo snap install upload-assets - - name: Upload to assets server - run: upload-assets --url-path vanilla-framework-version-$(cat css/VANILLA_VERSION).min.css css/build.css + - name: Upload assets to assets server + run: | + upload-assets --url-path vanilla-framework-version-$(cat css/VANILLA_VERSION).min.css css/build.css + upload-assets --url-path vanilla-framework-version-$(cat js/VANILLA_VERSION).min.mjs build/js/vanilla.bundle.mjs env: UPLOAD_ASSETS_API_TOKEN: ${{secrets.UPLOAD_ASSETS_API_TOKEN}} - + notify-figma: name: Notify Figma library maintainers needs: publish-npm @@ -72,4 +114,4 @@ jobs: steps: - name: Notify Figma library maintainers run: | - curl -X POST -H "Content-Type: application/json" -d '{ "source": "Vanilla CSS", "change-summary": " [Vanilla release notes](${{ github.event.release.html_url }})" }' ${{ secrets.FIGMA_LIBRARY_ALERT_URL }} \ No newline at end of file + curl -X POST -H "Content-Type: application/json" -d '{ "source": "Vanilla CSS", "change-summary": " [Vanilla release notes](${{ github.event.release.html_url }})" }' ${{ secrets.FIGMA_LIBRARY_ALERT_URL }} diff --git a/guides/release-process.md b/guides/release-process.md index f5c0acdd2..03b189c26 100644 --- a/guides/release-process.md +++ b/guides/release-process.md @@ -49,6 +49,7 @@ In case that fails, here are manual steps to release to assets server: - `dotrun build` - `upload-assets --url-path vanilla-framework-version-X.X.X.min.css build/css/build.css` +- `upload-assets --url-path vanilla-framework-version-X.X.X.min.mjs build/js/vanilla.bundle.mjs` ## Deploying vanillaframework.io From af4c8d2485333b7340f7ef2f8b1d56f8ae3d3ceb Mon Sep 17 00:00:00 2001 From: Muhammad Ali Date: Fri, 17 Oct 2025 11:50:21 +0500 Subject: [PATCH 2/2] setup QA --- .github/workflows/pr.yml | 82 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 77d98b9f8..6190a7c5d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -70,3 +70,85 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} reporter: github-pr-check fail-on-error: true + + build-css: + name: Build Vanilla CSS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Read Vanilla version from package.json + run: | + node -p "require('./package.json').version" > VANILLA_VERSION + echo "Building Vanilla CSS v$(cat VANILLA_VERSION)" + - run: yarn install + - run: yarn build + - run: yarn test + - name: Show size of the build file + run: stat -c '%s' build/css/build.css + - run: cp VANILLA_VERSION build/css + - uses: actions/upload-artifact@v4 + with: + name: css + path: build/css + build-js: + name: Build Vanilla JS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Read Vanilla version from package.json + run: | + node -p "require('./package.json').version" > VANILLA_VERSION + echo "Building Vanilla JS v$(cat VANILLA_VERSION)" + - name: Install esbuild and dependencies + run: npm install esbuild + - name: Create esbuild configuration file + # This step creates a script to execute your specific esbuild configuration + run: | + echo 'require("esbuild").build({ + entryPoints: ["templates/static/js/index.js"], + bundle: true, + outfile: "build/js/vanilla.bundle.mjs", + format: "esm", + sourcemap: true, + minify: true, + tsconfigRaw: {}, + });' > esbuild-config.js + - name: Run esbuild to generate ESM bundle + run: node esbuild-config.js + - name: Show size of the build file + run: stat -c '%s' build/js/vanilla.bundle.mjs + - run: cp VANILLA_VERSION build/js + - uses: actions/upload-artifact@v4 + with: + name: js + path: build/js/vanilla.bundle.mjs + build: + name: Build Vanilla CSS and JS + runs-on: ubuntu-latest + needs: [build-css, build-js] + + + publish-assets: + name: Publish to assets server + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: css + path: css + - name: Install upload-assets snap + run: sudo snap install upload-assets + - name: Upload assets to assets server + run: | + upload-assets --url-path vanilla-framework-version-$(cat css/VANILLA_VERSION).min.css css/build.css + upload-assets --url-path vanilla-framework-version-$(cat js/VANILLA_VERSION).min.mjs build/js/vanilla.bundle.mjs + env: + UPLOAD_ASSETS_API_TOKEN: ${{secrets.UPLOAD_ASSETS_API_TOKEN}} \ No newline at end of file