Merge pull request #75 from unum-cloud/main-dev #32
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: Release | |
on: | |
push: | |
branches: ["main"] | |
env: | |
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
versioning: | |
name: Semantic Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- run: npm install --save-dev --prefix ./package-ci @semantic-release/exec @semantic-release/git conventional-changelog-eslint semantic-release && npx --prefix ./package-ci semantic-release | |
rebase: | |
name: Rebase Dev. Branch | |
needs: versioning | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the latest code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Perform rebase | |
run: | | |
git fetch origin main | |
git checkout main-dev | |
git rebase origin/main | |
- name: Push changes | |
uses: CasperWA/push-protected@v2 | |
with: | |
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} | |
branch: main-dev | |
unprotect_reviews: True | |
force: True | |
test_python: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
needs: versioning | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "main" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[onnx]" | |
pip install pytest | |
- name: Run PyTest | |
run: pytest python/scripts/ | |
pypi_publish: | |
name: Publish Python | |
runs-on: ubuntu-latest | |
needs: versioning | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: "main" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish to PyPi | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
deploy_docs: | |
name: Deploy Docs | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-22.04 | |
needs: pypi_publish | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: "main" | |
- name: Setup GitHub Pages | |
uses: actions/configure-pages@v2 | |
- name: Install dependencies | |
run: sudo apt update && sudo apt install -y doxygen graphviz dia git && pip install sphinx==7.1.2 breathe furo m2r2 sphinxcontrib-googleanalytics==0.2.dev20220708 sphinxcontrib-jquery toml | |
- name: Install UForm from PyPi | |
run: pip install uform | |
- name: Build documentation | |
run: cd docs && make html | |
- name: Copy assets | |
run: cp -r assets build/docs/html/ | |
- name: Upload artifacts | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: "./build/docs/html/" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |