Skip to content

Commit 1ca383e

Browse files
CIDI: Including publishing workflows
1 parent 6752e2c commit 1ca383e

3 files changed

Lines changed: 129 additions & 1 deletion

File tree

.github/workflows/docs.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish Docs
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
tags: ["v*"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build_docs:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout pyvisual
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version-file: .python-version
23+
cache: pip
24+
25+
- name: Install docs dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install -e ".[docs]"
29+
30+
- name: Build docs
31+
run: |
32+
sphinx-build docs/source docs/_build/html
33+
34+
- name: Upload docs artifact
35+
if: always()
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: docs
39+
path: docs/_build/html/
40+
retention-days: 7
41+
42+
- name: Install SSH key
43+
uses: shimataro/ssh-key-action@v2
44+
with:
45+
key: ${{ secrets.DOCS_SSH_KEY }}
46+
known_hosts: "placeholder"
47+
48+
- name: Add known_hosts from target
49+
env:
50+
SSH_HOST: ${{ secrets.DOCS_SSH_HOST }}
51+
SSH_PORT: ${{ secrets.DOCS_SSH_PORT }}
52+
run: |
53+
mkdir -p ~/.ssh
54+
ssh-keyscan -p "${SSH_PORT:-22}" -H "${SSH_HOST}" >> ~/.ssh/known_hosts
55+
56+
- name: Rsync to server
57+
env:
58+
SSH_HOST: ${{ secrets.DOCS_SSH_HOST }}
59+
SSH_USER: ${{ secrets.DOCS_SSH_USER }}
60+
SSH_PORT: ${{ secrets.DOCS_SSH_PORT }}
61+
REMOTE_DIR: ${{ secrets.DOCS_SSH_PATH }}
62+
run: |
63+
ssh -p "${SSH_PORT:-22}" "${SSH_USER}@${SSH_HOST}" "mkdir -p '${REMOTE_DIR}'"
64+
65+
rsync -rlvz \
66+
--delete \
67+
--omit-dir-times --no-times \
68+
--no-perms --no-owner --no-group \
69+
-e "ssh -p ${SSH_PORT:-22}" \
70+
docs/_build/html/ "${SSH_USER}@${SSH_HOST}:${REMOTE_DIR}/"

.github/workflows/publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Publish
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags: ["v*"]
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test_build_target:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-python@v5
20+
with:
21+
python-version-file: .python-version
22+
23+
- name: Build sdist + wheel
24+
run: |
25+
python -m pip install -U pip build
26+
python -m build --sdist --wheel --outdir dist
27+
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: dist
31+
path: dist/*
32+
retention-days: 7
33+
34+
publish:
35+
needs: test_build_target
36+
runs-on: ubuntu-latest
37+
#if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
38+
permissions:
39+
id-token: write
40+
contents: write
41+
steps:
42+
- uses: actions/download-artifact@v4
43+
with:
44+
name: dist
45+
path: dist
46+
47+
- name: Publish to PyPI
48+
uses: pypa/gh-action-pypi-publish@release/v1
49+
with:
50+
packages-dir: dist
51+
52+
- name: Upload to GitHub releases
53+
uses: softprops/action-gh-release@v2.4.1
54+
with:
55+
draft: false
56+
generate_release_notes: false
57+
files: |
58+
dist/*

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ requires = ["setuptools >= 77.0.3"]
1111
# ----------------
1212
[project]
1313
name = "psi-pyvisual"
14-
version = "0.9.0"
14+
version = "0.9.1"
1515
description = "3D Visualization Tools for Solar Physics"
1616
authors = [
1717
{name = "Predictive Science Inc.", email = "webmaster@predsci.com"},

0 commit comments

Comments
 (0)