fix: Add missing checklists loader (#187) #22
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: Publish Support Sphere Python Package to PyPI and TestPyPI | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'src/support_sphere_py/**' | |
branches: | |
- main | |
release: | |
types: | |
- published | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 3 | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
dist: | |
name: Distribution build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./src/support_sphere_py | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: hynek/build-and-inspect-python-package@v2 | |
with: | |
path: src/support_sphere_py/ | |
test-built-dist: | |
needs: [dist] | |
name: Test built distribution | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/[email protected] | |
name: Install Python | |
with: | |
python-version: "3.12" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Packages | |
path: dist | |
- name: List contents of built dist | |
run: | | |
ls -ltrh | |
ls -ltrh dist | |
- name: Publish to Test PyPI | |
uses: pypa/[email protected] | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
verbose: true | |
skip-existing: true | |
- name: Check pypi packages | |
run: | | |
sleep 3 | |
python -m pip install --upgrade pip | |
echo "=== Testing wheel file ===" | |
# Install wheel to get dependencies and check import | |
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre --only-binary=:all: support_sphere_py | |
python -c "import support_sphere; print(support_sphere.__version__)" | |
echo "=== Done testing wheel file ===" | |
echo "=== Testing source tar file ===" | |
# Install tar gz and check import | |
python -m pip uninstall --yes support_sphere_py | |
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre --no-binary=support_sphere_py support_sphere_py | |
python -c "import support_sphere; print(support_sphere.__version__)" | |
echo "=== Done testing source tar file ===" | |
publish: | |
needs: [dist, test-built-dist] | |
name: Publish to PyPI | |
environment: pypi | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: Packages | |
path: dist | |
- uses: pypa/[email protected] | |
if: startsWith(github.ref, 'refs/tags') | |
push_to_registry: | |
name: Push Docker image to GH Container Registry | |
needs: [test-built-dist] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delay for PyPI | |
run: sleep 5 # Wait for the package to be available in PyPI | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Log in to registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./deployment/docker/ | |
file: ./deployment/docker/populate_db.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: ${{ github.event_name != 'pull_request' }} | |
build-args: VERSION=${{needs.test-built-dist.outputs.package-version}} |