Merge pull request #11 from quantinuum-dev/python-fixes #19
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 library | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: write | |
| pages: write | |
| packages: write | |
| id-token: write | |
| jobs: | |
| lint_node: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| # Path to the lock file needs to be specified explicitly as it is not in the root of the repository | |
| cache-dependency-path: 'documentation-ui/package-lock.json' | |
| - name: Lint documentation UI JS package | |
| working-directory: documentation-ui | |
| run: | | |
| npm ci | |
| npm run lint | |
| build_and_release_node: | |
| runs-on: ubuntu-latest | |
| needs: lint_node | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| # Path to the lock file needs to be specified explicitly as it is not in the root of the repository | |
| cache-dependency-path: 'documentation-ui/package-lock.json' | |
| - name: Build documentation UI JS package | |
| working-directory: documentation-ui | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Release documentation UI JS package | |
| working-directory: documentation-ui | |
| run: | | |
| npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| release_pypi: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install poetry | |
| run: pipx install poetry | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| cache: 'poetry' | |
| cache-dependency-path: 'sphinx-ui/pyproject.toml' | |
| - name: Set up Node.js for UI Assets | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| cache-dependency-path: 'sphinx-ui/react/package-lock.json' | |
| - name: Build documentation UI JS package | |
| working-directory: documentation-ui | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Generate UI Assets | |
| working-directory: sphinx-ui/react | |
| run: | | |
| echo "🔨 Generating UI assets..." | |
| npm install | |
| npm run build | |
| cp ./build/injectNav.global.js ../quantinuum_sphinx/static/injectNav.global.js | |
| cp ./build/syncTheme.global.js ../quantinuum_sphinx/static/syncTheme.global.js | |
| cp ./node_modules/@quantinuum/documentation-ui/dist/tokens.css ../quantinuum_sphinx/static/styles/quantinuum-ui-tokens.css | |
| npx tailwindcss --postcss ./postcss.config.cjs -i ./index.css -o ../quantinuum_sphinx/static/styles/quantinuum-ui-tailwind.css | |
| echo ✅ "Done. Generated UI assets." | |
| - name: Build and Publish to PyPI | |
| working-directory: sphinx-ui | |
| env: | |
| PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| echo "📦 Building and publishing to PyPI..." | |
| poetry config http-basic.pypi_local ${{ secrets.PYPI_USERNAME }} ${{ secrets.PYPI_API_TOKEN }} | |
| poetry build | |
| poetry publish | |
| echo ✅ "Done. Published Package to PyPI." |