Skip to content

⬆️🪝 update pre-commit hooks (#318) #1175

⬆️🪝 update pre-commit hooks (#318)

⬆️🪝 update pre-commit hooks (#318) #1175

Workflow file for this run

name: Deploy to PyPI
on:
release:
types: [published]
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }}
CDA_HOST_NAME: tueicda-cda.srv.mwn.de
CDA_USER_NAME: web-user
CDA_TARGET_DIR: /var/www/cda/app/mqtbench/
jobs:
build_wheel:
name: Build wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
name: Install Python
- name: Build wheel
run: pipx run build --wheel
- name: Install wheel
run: python -m pip install --verbose dist/*.whl
- uses: actions/upload-artifact@v4
with:
name: cibw-wheel
path: dist/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
name: Install Python
- name: Build sdist
run: pipx run build --sdist
- name: Install sdist
run: python -m pip install --verbose dist/*.tar.gz
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheel, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: pypi
url: https://pypi.org/p/mqt.bench
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
upload_webserver:
needs: upload_pypi
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create version file
run: |
echo "version = \"$(git describe --tags --always)\"" > mqtbench_version.txt
- name: Setup SSH via the stored Action Secrets
run: |
mkdir -p ~/.ssh
echo "${KNOWN_HOSTS}" >> ~/.ssh/known_hosts
echo "${DEPLOY_KEY}" > ~/.ssh/my_rsync_key
echo "IdentityFile ~/.ssh/my_rsync_key" >> ~/.ssh/config
chmod -R 700 ~/.ssh
- name: Copy version file to the webserver
working-directory: ${{ github.workspace }}
run: |
rsync -avz -e ssh mqtbench_version.txt ${CDA_USER_NAME}@${CDA_HOST_NAME}:${CDA_TARGET_DIR}/mqtbench_version.txt