Skip to content

Publish to PyPI

Publish to PyPI #22

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [created]
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: read
packages: write
attestations: write
jobs:
deploy:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
# python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: hatch build
- name: Test package
run: hatch -e test run nose2 --verbose
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://upload.pypi.org/legacy/
container-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: build & push image
run: |
version=$( cat calrissian/__about__.py | cut -d "=" -f 2 | tr -d '"' )
IMAGE_ID=ghcr.io/duke-gcb/calrissian/calrissian
docker build . --file Dockerfile --tag calrissian
docker tag calrissian $IMAGE_ID:$version
docker push $IMAGE_ID:$version