Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New fully automated process to build/tag/release (GitHub) & publish (PyPi) versions #1324

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions .github/workflows/cd.yaml

This file was deleted.

87 changes: 87 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CD

on:
workflow_dispatch:
inputs:
dry-run:
type: boolean
description: "Dry-run"
required: true
default: true
version:
description: "SemVer string for new version"
required: true


jobs:
build:
runs-on: ubuntu-latest
environment:
name: protected
steps:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Build Python packages
uses: hynek/build-and-inspect-python-package@v2

tag:
runs-on: ubuntu-latest
environment:
name: protected
permissions:
contents: write
outputs:
new_tag: ${{ steps.tag_version.outputs.new_tag }}
changelog: ${{ steps.tag_version.outputs.changelog }}
steps:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Tag new version
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ github.token }}
default_bump: "false"
custom_tag: ${{ inputs.version }}
tag_prefix: ""
dry_run: ${{ inputs.dry-run }}

release:
needs:
- build
- tag
runs-on: ubuntu-latest
environment:
name: protected
permissions:
contents: write
steps:
- name: Download built Python packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Create GitHub Release with Python packages
uses: ncipollo/release-action@v1
with:
artifacts: dist/*
tag: ${{ needs.tag.outputs.new_tag }}
body: ${{ needs.tag.outputs.changelog }}
draft: ${{ inputs.dry-run }}

publish:
needs: release
runs-on: ubuntu-latest
if: ${{ ! inputs.dry-run }}
environment:
name: publish
permissions:
id-token: write
steps:
- name: Download built Python package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
File renamed without changes.
Loading