Skip to content

Build and Release

Build and Release #3

Workflow file for this run

name: Build and Release
on:
create:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
env:
PACKAGE_NAME: rydiqule
jobs:
build:
name: Build
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Build Tools
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: Build Source Distribution
run: |
python -m build -s .
- name: Build Wheel Distribution
run: |
python -m build -w .
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: ./dist
github-release:
name: Github Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build]
permissions:
packages: read
contents: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: dist
path: ./dist
- name: Get Version Number
run: |
VERSION="${GITHUB_REF/refs\/tags\/v/}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create Github Release and Upload Release Asset
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.ref }}
name: ${{ env.PACKAGE_NAME }} ${{ env.VERSION }}
draft: true
prerelease: ${{ contains(github.event.ref, 'rc') }}
files: ./dist/${{ env.PACKAGE_NAME }}-${{ env.VERSION }}.tar.gz
release:
name: PyPI Release
runs-on: ubuntu-latest
if: github.repository_owner == 'QTC-UMD'
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/${{ env.PACKAGE_NAME }}
permissions:
id-token: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: dist
path: ./dist
- name: Publish on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1