Skip to content

Revert "Merge branch 'master' into mvc" #3031

Revert "Merge branch 'master' into mvc"

Revert "Merge branch 'master' into mvc" #3031

Workflow file for this run

# A single CI script with github workflow
name: Build wheels and deploy
on:
push:
release:
types:
- published
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, '3.10']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build wheels
run: |
python -m pip install --upgrade pip
pip install wheel
python setup.py sdist bdist_wheel
- name: Store wheels as artifacts
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download wheels from artifact storage
uses: actions/download-artifact@v2
with:
name: wheels
path: dist
- name: Setup Python
uses: actions/setup-python@v2
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_TOKEN }}
- uses: actions/checkout@v2
- name: Build docker image and upload to ghcr
run: |
IMAGE_NAME=qibo
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
docker build . --file docker/dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION