Skip to content

Merge pull request #3 from FNNDSC/migrate-to-rye #31

Merge pull request #3 from FNNDSC/migrate-to-rye

Merge pull request #3 from FNNDSC/migrate-to-rye #31

Workflow file for this run

name: Release
on:
push:
tags:
- "v?[0-9]+.[0-9]+.[0-9]+*"
env:
logo: https://github.com/FNNDSC/cube-design/blob/master/_common-assets/ChRISlogo-color.svg.png?raw=true
jobs:
release:
name: Release
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Install rye
uses: eifinger/setup-rye@d4c3ac7b15d8bf2e0b45e2d257c6b5cdbebc3643 # v4.2.1
with:
version: '0.36.0'
enable-cache: true
cache-prefix: ${{ github.workflow }}
- name: Set version
run: rye version '${{ github.ref_name }}'
- run: rye sync
- name: Build
run: rye build --wheel --clean --verbose
- name: Publish
run: rye publish --yes --token '${{ secrets.PYPI_API_TOKEN }}' --verbose
- name: pdoc
run: |
rye run pdoc \
--logo '${{ env.logo }}' \
--footer-text='Version ${{ github.ref_name }}' \
--docformat numpy \
aiochris -o pdoc
- name: Deploy docs (version)
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: pdoc
clean: true
clean-exclude: 'v*.*.*/'
target-folder: "${{ github.ref_name }}"
- name: Deploy docs (latest)
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: pdoc
clean: false
# ref: https://rye.astral.sh/guide/docker/
- name: Create Dockerfile
run: |
python_version="$(< .python_version)"
version="$(rye version)"
now="$(date --rfc-3339=seconds)"
tee Dockerfile << EOF
FROM docker.io/library/python:${python_version}-alpine
LABEL org.opencontainers.image.created="$now" \
org.opencontainers.image.authors="Jennings Zhang, FNNDSC <[email protected]>" \
org.opencontainers.image.url="${{ github.server_url }}/${{ github.repository }}" \
org.opencontainers.image.source="${{ github.server_url }}/${{ github.repository }}" \
org.opencontainers.image.documentation="https://fnndsc.github.io/aiochris/v$version/" \
org.opencontainers.image.version="$version" \
org.opencontainers.image.revision="${{ github.ref_name }}" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.title="aiochris Python package" \
org.opencontainers.image.description="Python async client library for ChRIS"
RUN --mount=source=dist,target=/dist PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir /dist/*.whl
EOF
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: get-version
run: echo "version=$(rye version)" >> "$GITHUB_OUTPUT"
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/fnndsc/aiochris:${{ steps.get-version.outputs.version }}
ghcr.io/fnndsc/aiochris:latest
platforms: linux/amd64,linux/ppc64le,linux/arm64
- name: Draft Github Release
uses: softprops/action-gh-release@v2
with:
draft: true
body: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ github.ref_name }}"