mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* Migrate Python repositories to Trusted Publishers * Update build.yaml * Update .github/workflows/build.yaml Co-authored-by: Helio Machado <[email protected]> * Update build.yaml --------- Co-authored-by: skshetry <[email protected]>
50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: Build package
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
release:
|
|
types: [released, prereleased]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
pip:
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
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
|