mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
111 lines
3.2 KiB
YAML
111 lines
3.2 KiB
YAML
name: Build packages
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
release:
|
|
types: [released, prereleased]
|
|
workflow_dispatch:
|
|
|
|
permissions: # added using https://github.com/step-security/secure-workflows
|
|
contents: read
|
|
|
|
jobs:
|
|
binary:
|
|
permissions:
|
|
contents: write # for actions/upload-release-asset to upload release asset
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- {pkg: "deb", os: "ubuntu-18.04", asset: "dvc_${{ github.event.release.tag_name }}_amd64.deb"}
|
|
- {pkg: "rpm", os: "ubuntu-18.04", asset: "dvc-${{ github.event.release.tag_name }}-1.x86_64.rpm"}
|
|
- {pkg: "osxpkg", os: "macos-10.15", asset: "dvc-${{ github.event.release.tag_name }}.pkg"}
|
|
- {pkg: "exe", os: "windows-2019", asset: "dvc-${{ github.event.release.tag_name }}.exe"}
|
|
|
|
name: ${{ matrix.pkg }}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python 3.9
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.9
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
pyproject.toml
|
|
scripts/build-requirements.txt
|
|
|
|
- name: Set up Ruby 2.6
|
|
uses: ruby/setup-ruby@v1
|
|
if: matrix.pkg != 'exe'
|
|
with:
|
|
ruby-version: '2.6'
|
|
|
|
- name: Install fpm
|
|
if: matrix.pkg != 'exe'
|
|
run: gem install --no-document fpm
|
|
|
|
- name: Install deps
|
|
run: |
|
|
pip install -U wheel pip setuptools
|
|
pip install .[all]
|
|
pip install -r scripts/build-requirements.txt
|
|
|
|
- name: Pull images
|
|
run: dvc pull
|
|
|
|
- name: Build ${{ matrix.pkg }}
|
|
run: python scripts/build.py ${{ matrix.pkg }}
|
|
|
|
- name: Publish ${{ matrix.pkg }}
|
|
if: github.event_name == 'release'
|
|
uses: actions/[email protected]
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
asset_path: scripts/${{ matrix.pkg == 'exe' && 'innosetup' || 'fpm' }}/${{ matrix.asset }}
|
|
asset_name: ${{ matrix.asset }}
|
|
asset_content_type: binary/octet-stream
|
|
|
|
pip:
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python 3.8
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.8
|
|
|
|
- name: Install
|
|
run: pip install -U wheel pip build setuptools_scm
|
|
|
|
- name: Force version for Test PyPI uploads
|
|
if: ${{ !startsWith(github.ref, 'refs/tags') }}
|
|
run: echo version=$(python -m setuptools_scm | awk -F+ '{print $1}' | tail -1) >> $GITHUB_ENV
|
|
|
|
- name: Build packages
|
|
run: ./scripts/build_package.sh
|
|
env:
|
|
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.version }}
|
|
|
|
- name: Publish packages to PyPI
|
|
if: github.event_name == 'release'
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
password: ${{ secrets.PYPI_TOKEN }}
|
|
|
|
- name: Publish to Test PyPI
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
password: ${{ secrets.TEST_PYPI_TOKEN }}
|
|
repository_url: https://test.pypi.org/legacy/
|
|
skip_existing: true
|