Next Build Test Publish #69
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: Next Build Test Publish | |
| on: | |
| schedule: | |
| - cron: '0 1 * * 6' # Runs every Saturday at midnight | |
| workflow_dispatch: # Allows manual triggering | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| #permissions: | |
| # Give the default GITHUB_TOKEN write permission to commit and push the | |
| # added or changed files to the repository. | |
| #contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: eelab-dev/EEcircuit-engine | |
| ref: main # Checkout the "main" branch | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create Empty Build Directory | |
| run: mkdir -p Docker/build | |
| - name: Build Docker Image | |
| run: docker build --no-cache -t eecircuit ./Docker | |
| - name: Run Docker Container | |
| run: docker run -t -e VERSION=next -v $(realpath ./Docker):/mnt eecircuit | |
| - name: Run Inject.mjs | |
| run: node ./Docker/inject.mjs | |
| - name: Rename and Copy Files to Main Directory | |
| run: | | |
| cp ./Docker/build/spice.wasm ./src/spice.wasm | |
| cp ./Docker/build/spice-eesim.js ./src/spice.js | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update Dependencies | |
| run: npx --yes npm-check-updates -u | |
| - name: Install Dependencies | |
| run: npm install | |
| - name: Test node (source) | |
| run: npm run test:source -- next | |
| - name: Build Project with Vite | |
| run: npm run build | |
| - name: Test node (package) | |
| run: npm run test:package -- next | |
| - name: Install browsers | |
| run: npx playwright install --with-deps | |
| - name: Test browser | |
| run: npm run test:browser | |
| env: | |
| REF_VERSION: next | |
| - name: Get the current version and set dynamic next version | |
| run: | | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "Current version: $CURRENT_VERSION" | |
| NEW_VERSION="${CURRENT_VERSION}-next.$(date +%s)" | |
| echo "New version: $NEW_VERSION" | |
| npm version "$NEW_VERSION" --no-git-tag-version | |
| - name: Publish to npm | |
| run: npm publish --tag next | |