Skip to content

Publish viASP to PyPi #6

Publish viASP to PyPi

Publish viASP to PyPi #6

Workflow file for this run

name: Publish viASP to PyPi
on:
workflow_dispatch:
inputs:
frontend:
type: boolean
required: true
description: Publish frontend of main HEAD
backend:
type: boolean
required: true
description: Publish backend of main HEAD
jobs:
backend:
name: Publish backend
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Get artifact
if: ${{ github.event.inputs.backend == 'true' }}
uses: dawidd6/action-download-artifact@v2
with:
workflow: build_and_test.yml
path: dist
commit: ${{ github.sha }}
name: backend-${{ github.sha }}
- name: Publish on PyPi
if: ${{ github.event.inputs.backend == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://upload.pypi.org/legacy/
frontend:
name: Publish frontend
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Get artifact
if: ${{ github.event.inputs.frontend == 'true' }}
uses: dawidd6/action-download-artifact@v2 # version from GitHub disallows sharing between workflows
with:
workflow: build_and_test.yml
path: dist
commit: ${{ github.sha }}
name: frontend-${{ github.sha }}
- name: Publish on PyPi
if: ${{ github.event.inputs.frontend == 'true' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://upload.pypi.org/legacy/
wrapper:
needs: [ frontend, backend ]
name: Publish container
if: ${{ github.event.inputs.frontend == 'true' || github.event.inputs.backend == 'true' }}
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checking out repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Cache conda env
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}
id: cache
- name: Building wrapper
run: python -m build --sdist --wheel --outdir dist/;
- name: Publish on PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://upload.pypi.org/legacy/
packages-dir: dist