Skip to content

Merge pull request #14 from scs/feature/update #90

Merge pull request #14 from scs/feature/update

Merge pull request #14 from scs/feature/update #90

Workflow file for this run

name: Publish Python package to PyPI / Test PyPI
on:
push:
branches:
- "**"
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-publish:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: backend
name: Build a Python package and upload it to PyPI / Test PyPI
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "pipenv"
cache-dependency-path: backend/Pipfile.lock
- name: Install pipenv
run: |
python -m pip install --upgrade pip pipenv
python --version; python -m pip --version; pipenv --version
- name: Setup backend project with pipenv
run: |
pipenv --python 3.9 install --dev
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: "npm"
cache-dependency-path: frontend/smartmeter-datacollector-configurator/package-lock.json
- name: Setup frontend project with npm
working-directory: frontend/smartmeter-datacollector-configurator
run: |
npm ci --ignore-scripts
- name: Build a Python package
run: |
pipenv run build
- name: Archive the built Python package
uses: actions/upload-artifact@v3
with:
name: smartmeter-datacollector-configurator-py
path: backend/dist/*
- name: Publish the Python package to Test PyPI
if: github.ref == 'refs/heads/master'
uses: pypa/[email protected]
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
packages_dir: backend/dist/
skip_existing: true
- name: Publish the Python package to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: backend/dist/
- name: Get the tag name
id: tag-name
if: startsWith(github.ref, 'refs/tags')
uses: olegtarasov/[email protected]
- name: Create a new release
if: startsWith(github.ref, 'refs/tags')
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: backend/dist/*.tar.gz,backend/dist/*.whl
draft: true
name: Smart Meter Data Collector Configurator ${{ steps.tag-name.outputs.tag }}
omitBody: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
token: ${{ secrets.GITHUB_TOKEN }}