Build and Publish #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2023 The ORTHW Project Authors | |
# | |
# 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 | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# 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. | |
# SPDX-License-Identifier: Apache-2.0 | |
# SPDX-FileCopyrightText: 2023 Helio Chissini de Castro | |
name: Build and Publish | |
on: | |
workflow_run: | |
workflows: | |
- Validation | |
types: | |
- completed | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
build_deploy: | |
name: Build and Deploy Python OrtHW | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'poetry' | |
- name: Setup poetry project | |
run: | | |
poetry install -q | |
poetry build | |
- name: Check 📦 package | |
run: | | |
poetry run twine check dist/* | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: dist/* | |
- name: Publish 📦 package | |
if: github.event_name == 'push' | |
env: | |
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USER }} | |
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | |
run: poetry run twine upload -r testpypi dist/* |