-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (92 loc) · 3.27 KB
/
release.yml
File metadata and controls
96 lines (92 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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: 20
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
needs: build_and_release_node
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: Generate UI Assets
working-directory: sphinx-ui/react
run: |
echo "🔨 Generating UI assets..."
npm update @quantinuum/documentation-ui
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/quantinuum-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."