Merge branch 'main' of https://github.com/unum-cloud/uform #24
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
# This workflow will upload a Python Package using Twine when a release is created | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
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@v3 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v3 | |
- run: cp .github/workflows/package.json . && npm install && npx semantic-release | |
rebase: | |
name: Rebase Dev. Branch | |
needs: versioning | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the latest code | |
uses: actions/checkout@v3 | |
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 | |
pypi_publish: | |
name: Publish Python | |
runs-on: ubuntu-latest | |
needs: versioning | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: 'main' | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
# Install dependencies: | |
# - build: for PyPi | |
# - anaconda-client: for Anaconda | |
# - urllib3: for Anaconda, as it is a dependency of anaconda-client | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build anaconda-client 'urllib3<2.0.0' | |
- name: Build package | |
run: python -m build | |
- name: Publish to PyPi | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Publish to Anaconda | |
run: | | |
pip install anaconda-client | |
export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_API_TOKEN }} | |
anaconda login --token $ANACONDA_API_TOKEN | |
anaconda upload -u unum-cloud ./dist/*.tar.bz2 | |
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@v3 | |
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 |