0.8.2 #22
Workflow file for this run
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 | |
on: | |
release: | |
types: [published] | |
jobs: | |
pypi-build-and-publish: | |
name: Build and publish Python package to PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/git-goose | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.13 | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
check-latest: true | |
- name: Install dependencies | |
run: python3 -m pip install --upgrade build pkginfo | |
- name: Build | |
run: python3 -m build --sdist --wheel . | |
- name: Inspect built wheel version | |
id: inspect-wheel-version | |
run: | | |
python3 << 'EOF' >> $GITHUB_OUTPUT | |
from pathlib import Path | |
from pkginfo import Wheel | |
[wheel_path] = Path("dist").glob("*.whl") | |
wheel = Wheel(wheel_path) | |
print(f"version={wheel.version}") | |
EOF | |
- name: Fail on version mismatch | |
if: ${{ steps.inspect-wheel-version.outputs.version != github.event.release.tag_name }} | |
run: | | |
echo "💥 The version of the built wheel does not match the release tag." | |
echo | |
echo "Release tag: '${{ github.event.release.tag_name }}'" | |
echo "Packaged version: '${{ steps.inspect-wheel-version.outputs.version }}'" | |
exit 1 | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
ghcr-build-and-publish: | |
name: Build and publish Docker container image to GHCR | |
runs-on: ubuntu-latest | |
environment: | |
name: ghcr | |
url: "https://github.com/antonagestam/goose/pkgs/container/goose" | |
env: | |
registry: ghcr.io | |
image_name: ${{ github.repository }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.registry }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.registry }}/${{ env.image_name }} | |
- uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
RELEASE_VERSION=${{ github.event.release.tag_name }} |