Skip to content

Add release process to CI pipeline #2

Add release process to CI pipeline

Add release process to CI pipeline #2

Workflow file for this run

name: CI
on:
push:
branches:
- master
pull_request:
release:
types:
- published
workflow_dispatch:
jobs:
build_wheel:
name: Build pure-Python wheel and source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build wheel
run: pipx run build
- uses: actions/upload-artifact@v4
with:
path: dist/*
test_wheel:
needs: [build_wheel]
name: Test pure-Python wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Test wheel
run: |
export WHEELFILE=`ls -1 dist/*.whl | head -n 1`
python -m venv pyasn1-alt-modules-testbed
source pyasn1-alt-modules-testbed/bin/activate
pip install "$WHEELFILE"
python -m unittest discover -s tests
release_wheel:
needs: [test_wheel]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published' || github.event_name == 'workflow_dispatch'
environment:
name: "${{ github.event.name == 'release' && 'pypi' || 'testpypi' }}"
url: "${{ github.event.name == 'release' && 'https://pypi.org/p/pyasn1-alt-modules' || 'https://test.pypi.org/p/pyasn1-alt-modules' }}"
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1