Release π distribution #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release π distribution | |
on: | |
workflow_dispatch: | |
jobs: | |
github-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
- name: Install dependencies | |
run: | | |
uv sync | |
- name: Get version from __init__.py | |
id: get_version | |
run: | | |
version=$(uv run python -c "from src.parllama import __version__; print(__version__)") | |
echo "Raw version output: $version" | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Check version | |
id: check_version | |
run: | | |
echo "Version in env: ${{ env.VERSION }}" | |
if [ -z "${{ env.VERSION }}" ]; then | |
echo "Error: VERSION is empty" | |
exit 1 | |
fi | |
- name: Restore cached build artifacts | |
uses: actions/cache@v4 | |
with: | |
path: dist | |
key: ${{ runner.os }}-3.11-x64-${{ hashFiles('**/pyproject.toml') }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-3.11-x64-${{ hashFiles('**/pyproject.toml') }}- | |
${{ runner.os }}-3.11-x64- | |
- name: Sign the dists with Sigstore | |
uses: sigstore/[email protected] | |
with: | |
inputs: >- | |
./dist/*.tar.gz | |
./dist/*.whl | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release create \ | |
'release-v${{ env.VERSION }}' \ | |
--repo '${{ github.repository }}' \ | |
--generate-notes \ | |
--latest | |
- name: Upload artifact signatures to GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload \ | |
'release-v${{ env.VERSION }}' dist/** \ | |
--repo '${{ github.repository }}' | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: 'A new release ${{ github.ref_name }} has been created for {{ EVENT_PAYLOAD.repository.full_name }}.' |