Skip to content
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
85 changes: 85 additions & 0 deletions .github/workflows/release.yaml
Copy link
Contributor Author

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.

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always writes error to STDERR: >&2

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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 = [
Expand Down