mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
48 lines
1.2 KiB
YAML
48 lines
1.2 KiB
YAML
name: Build package
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
release:
|
|
types: [released, prereleased]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
|
|
jobs:
|
|
pip:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.8
|
|
|
|
- run: python -m pip install --upgrade pip setuptools_scm build twine
|
|
- name: Force version for Test PyPI upload
|
|
if: ${{ !startsWith(github.ref, 'refs/tags') }}
|
|
run: echo version=$(python -m setuptools_scm | awk -F+ '{print $1}' | tail -1) >> $GITHUB_ENV
|
|
|
|
- run: |
|
|
echo 'PKG = "pip"'>dvc/_build.py
|
|
python -m build
|
|
env:
|
|
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.version }}
|
|
- run: twine check --strict dist/*
|
|
|
|
- name: Publish to PyPI
|
|
if: github.event_name == 'release'
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
- name: Publish to Test PyPI
|
|
if: ${{ github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
repository_url: https://test.pypi.org/legacy/
|
|
skip_existing: true
|