Files
chia-blockchain/.github/workflows/upload-pypi-source.yml
T
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Gene Hoffman
8781569829 Bump actions/checkout from 2 to 3 (#10505)
* Bump actions/checkout from 2 to 3

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update actions in templates too

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gene Hoffman <hoffmang@hoffmang.com>
2022-03-25 22:23:27 -07:00

89 lines
2.3 KiB
YAML

name: Lint and upload source distribution
on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- '**'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true
jobs:
upload_source_dist:
name: Lint and Upload source distribution
runs-on: [ubuntu-latest]
timeout-minutes: 30
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.8'
- name: Test for secrets access
id: check_secrets
shell: bash
run: |
unset HAS_SECRET
if [ -n "$SECRET" ]; then HAS_SECRET='true' ; fi
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
env:
SECRET: "${{ secrets.test_pypi_password }}"
- name: Install lint requirements
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install .[dev]
- name: Lint source with black
run: |
black --check --diff .
- name: Lint source with flake8
run: |
flake8 chia tests
- name: Lint source with mypy
run: |
mypy
- name: Build source distribution
run: |
python -m build --sdist --outdir dist .
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist
- name: Publish distribution to Test PyPI
if: steps.check_secrets.outputs.HAS_SECRET
env:
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'
- name: Publish distribution to PyPI
if: steps.check_secrets.outputs.HAS_SECRET && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'