-
Notifications
You must be signed in to change notification settings - Fork 1
[DPE-8030] Publishing workflow #6
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Copyright 2025 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- 16/edge | ||
|
||
concurrency: | ||
# Prevent race conditions (if multiple commits have been pushed since the last release) | ||
group: dpw-release-python-package-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
ci-tests: | ||
name: Tests | ||
uses: ./.github/workflows/ci.yaml | ||
secrets: inherit | ||
build: | ||
name: "Build package" | ||
needs: | ||
- ci-tests | ||
runs-on: ubuntu-latest | ||
outputs: | ||
VERSION: ${{ steps.export.outputs.VERSION }} | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v5 | ||
with: | ||
fetch-depth: 0 | ||
- name: "Install uv" | ||
run: sudo snap install astral-uv --classic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using UV instead of poetry. |
||
- name: "Export package information" | ||
id: export | ||
run: | | ||
VERSION=$(uv version --short) | ||
if [ "$(git tag -l "${VERSION}")" ]; then | ||
echo "Tag ${VERSION} already exists. Please bump the project to a greater version." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always writes error to STDERR: |
||
exit 1 | ||
fi | ||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" | ||
- name: "Build package" | ||
run: uv build | ||
- name: "Store the distribution packages" | ||
uses: actions/upload-artifact@v5 | ||
with: | ||
name: distfiles | ||
path: dist/ | ||
|
||
upload-github: | ||
name: "Publish to GitHub" | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout" | ||
uses: actions/checkout@v5 | ||
- name: "Download all the dists" | ||
uses: actions/download-artifact@v5 | ||
with: | ||
name: distfiles | ||
path: dist/ | ||
- name: "Create GitHub release" | ||
run: | | ||
git tag "${{ needs.build.outputs.VERSION }}" | ||
git push origin "${{ needs.build.outputs.VERSION }}" | ||
gh release create "${{ needs.build.outputs.VERSION }}" --generate-notes --title "${{ needs.build.outputs.VERSION }}" | ||
gh release upload "${{ needs.build.outputs.VERSION }}" dist/*.{tar.gz,whl} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
upload-pypi: | ||
name: "Publish to PyPI" | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Download all the dists" | ||
uses: actions/download-artifact@v5 | ||
with: | ||
name: distfiles | ||
path: dist/ | ||
- name: "Publish to PyPI" | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
permissions: | ||
id-token: write |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
|
||
[project] | ||
name = "postgresql-charms-single-kernel" | ||
dynamic = ["version"] | ||
description = "Shared and reusable code for PostgreSQL-related charms" | ||
version = "0.0.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ldap sync manually bumps the version. |
||
readme = "README.md" | ||
license = "Apache-2.0" | ||
authors = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly copied from postgresql-ldap-sync.