chore: release main #6707
Workflow file for this run
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: ^9 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
profile: minimal | |
override: true | |
target: wasm32-wasi | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
packages/swc | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Build packages | |
run: pnpm run build | |
- name: Pack packages | |
run: pnpm run pack | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifact | |
path: | | |
./ | |
!.git/ | |
!**/node_modules/ | |
!packages/swc/target/ | |
packages/swc/target/wasm32-wasi/release/import_meta_env_swc.wasm | |
!packages/examples/ | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: ^9 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
profile: minimal | |
override: true | |
target: wasm32-wasi | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
packages/swc | |
- name: Install dependencies | |
run: | | |
pnpm i --frozen-lockfile | |
rustup component add rustfmt | |
- name: Check formatting | |
run: pnpm run lint | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: ^9 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
profile: minimal | |
override: true | |
target: wasm32-wasi | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
packages/swc | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Test packages | |
run: pnpm run test | |
npm-node-lts-examples: | |
needs: | |
- build | |
- lint | |
- test | |
name: "Test example - ${{ matrix.example }}" | |
runs-on: ${{ matrix.os }} | |
env: | |
RUST_BACKTRACE: full | |
strategy: | |
matrix: | |
example: | |
- "@vue+cli@5-example" | |
- "angular-webpack-example" | |
- "babel-starter-example" | |
- "create-next-app-example" | |
- "create-react-app-example" | |
- "create-vue-app-example" | |
- "cypress-example" | |
- "docker-compose-starter-example" | |
- "docker-starter-example" | |
- "esbuild-starter-example" | |
- "farm-react-example" | |
- "jest-example" | |
- "mocha-example" | |
# - "nuxt-bridge-example" | |
- "nx-react-example" | |
- "process-env-example" | |
- "rollup-plugin-babel-example" | |
- "rollup-starter-example" | |
- "rollup-swc-example" | |
# - "rspack-starter-example" | |
- "swc-example" | |
- "vite-alpine-example" | |
- "vite-built-in-import-meta-env-example" | |
- "vite-config-build-assets-dir-example" | |
- "vite-config-build-out-dir-example" | |
- "vite-legacy-example" | |
- "vite-preact-example" | |
# - "vite-qwik-example" | |
- "vite-react-example" | |
- "vite-solid-example" | |
- "vite-starter-example" | |
- "vite-svelte-example" | |
- "vite-swc-example" | |
- "vite-vanilla-example" | |
- "vite-vanilla-ts-example" | |
- "vite-vue-jsx-example" | |
- "vite-vue-ts-example" | |
- "vitest-example" | |
- "webpack-module-federation-example" | |
- "webpack-babel-loader-example" | |
- "webpack-starter-example" | |
- "webpack-swc-example" | |
- "webpack-ts-loader-example" | |
- "worker-example" | |
include: | |
- os: ubuntu-latest | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
- name: Set node version to ${{ matrix.node_version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Test diff | |
run: | | |
cd packages/examples | |
npm i | |
cd ../../diff/after-using-import-meta-env | |
npm i | |
npm run _test | |
- name: Test ${{ matrix.example }} | |
run: | | |
cd packages/examples | |
npm i | |
cd ${{ matrix.example }} | |
npm i | |
npm run _test | |
npm-node-16-examples: | |
needs: | |
- build | |
- lint | |
- test | |
name: "Test example - ${{ matrix.example }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
example: | |
- "@vue+cli@4-example" | |
- "create-nuxt-app-example" | |
include: | |
- os: ubuntu-latest | |
node_version: 16 | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
- name: Set node version to ${{ matrix.node_version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node_version }} | |
- name: Test ${{ matrix.example }} | |
run: | | |
cd packages/examples | |
npm i | |
cd ${{ matrix.example }} | |
npm i | |
npm run _test | |
release: | |
name: Release | |
needs: | |
- build | |
- lint | |
- test | |
- npm-node-lts-examples | |
- npm-node-16-examples | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
- babel | |
- cli | |
- flow | |
- prepare | |
- swc | |
- typescript | |
- unplugin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: ^9 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
cache: "pnpm" | |
- name: Publish | |
uses: JS-DevTools/npm-publish@v3 | |
id: publish | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
package: packages/${{ matrix.package }}/package.json | |
tag: latest | |
access: public | |
dry-run: ${{ github.ref_name != 'main' }} | |
strategy: upgrade | |
- name: Tag | |
uses: anothrNick/github-tag-action@v1 | |
if: steps.publish.outputs.type | |
env: | |
DRY_RUN: ${{ github.ref_name != 'main' }} | |
CUSTOM_TAG: ${{ matrix.package }}${{ steps.publish.outputs.version }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: ${{ github.ref_name == 'main' && steps.publish.outputs.type }} | |
with: | |
tag_name: ${{ matrix.package }}${{ steps.publish.outputs.version }} | |
body: "Changelog: https://github.com/runtime-env/import-meta-env/blob/${{ matrix.package }}${{ steps.publish.outputs.version }}/packages/${{ matrix.package }}/CHANGELOG.md" | |
docs: | |
name: Docs | |
needs: | |
- build | |
- lint | |
- test | |
- npm-node-lts-examples | |
- npm-node-16-examples | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifact | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: ^9 | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Build docs | |
run: pnpm run docs:build | |
- name: Commit files | |
run: | | |
cd docs/.vitepress/dist | |
git init | |
git branch -m gh-pages | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "docs: deploy" | |
- name: Push docs | |
if: github.ref_name == 'main' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
directory: docs/.vitepress/dist | |
force: true |