Skip to content

Publish

Publish #25

Workflow file for this run

# Copyright © 2022 IOTIC LABS LTD. info@iotics.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://github.com/Iotic-Labs/iotics-grpc-client-py/blob/main/LICENSE
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Publish
on:
release:
types: [published]
workflow_dispatch:
jobs:
# Ensure package correctly imports dependencies and can communicate with the IOTICSpace.
verify:
name: Verify against a Space
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Check that the package can be imported
run: make verify-import
- name: Mask secrets
run: |
echo "::add-mask::${{ secrets.SPACE }}"
echo "::add-mask::${{ secrets.USER_DID }}"
echo "::add-mask::${{ secrets.AGENT_DID }}"
echo "::add-mask::${{ secrets.AGENT_SECRET }}"
echo "::add-mask::${{ secrets.AGENT_KEY_NAME }}"
echo "::add-mask::${{ secrets.AGENT_NAME }}"
- name: Run examples
run: make run-examples
env:
SPACE: ${{ secrets.SPACE }}
USER_DID: ${{ secrets.USER_DID }}
AGENT_DID: ${{ secrets.AGENT_DID }}
AGENT_SECRET: ${{ secrets.AGENT_SECRET }}
AGENT_KEY_NAME: ${{ secrets.AGENT_KEY_NAME }}
AGENT_NAME: ${{ secrets.AGENT_NAME }}
package:
name: Package the library
runs-on: ubuntu-latest
needs: verify
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel==0.36.2
- name: Package
run: |
python3 setup.py -q clean -a
python3 setup.py sdist bdist_wheel
- uses: actions/upload-artifact@master
with:
name: pkgs
path: dist/
check-pkgs:
name: Validate the packages on "${{ matrix.os }}" with python:${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
needs: package
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: [3.8, 3.9]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- uses: actions/download-artifact@master
with:
name: pkgs
path: .
- name: Check source package
run: |
pip install iotics-grpc-client-*.tar.gz
python -c 'import iotics.lib.grpc.iotics_api'
pip uninstall -y iotics-grpc-client
shell: bash
- name: Check wheel package
run: |
pip install iotics_grpc_client-*.whl
python -c 'import iotics.lib.grpc.iotics_api'
pip uninstall -y iotics-grpc-client
shell: bash
deploy:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: check-pkgs
steps:
- uses: actions/download-artifact@master
with:
name: pkgs
path: ./dist
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
# - name: Publish package to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.TEST_PYPI_PASSWORD }}
# repository_url: https://test.pypi.org/legacy/
# packages_dir: ./dist/
# verify_metadata: true
# verbose: true
# skip_existing: true
- name: Publish package to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD2024 }}
packages_dir: ./dist/
verify_metadata: true
verbose: true
skip_existing: false