mirror of
https://github.com/philippemerle/KubeDiagrams.git
synced 2026-02-14 10:00:08 +00:00
90 lines
2.3 KiB
YAML
90 lines
2.3 KiB
YAML
# When a release is created, this workflow will
|
|
# - build and upload KubeDiagrams Python Package to PyPI
|
|
# - build and upload KubeDiagrams images to DockerHub
|
|
|
|
name: Release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-pypa:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Build release distributions
|
|
run: |
|
|
python -m pip install build
|
|
python -m build
|
|
|
|
- name: Upload distributions
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-dists
|
|
path: dist/
|
|
|
|
pypi-publish:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-pypa
|
|
permissions:
|
|
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
id-token: write
|
|
environment:
|
|
name: pypi
|
|
url: https://pypi.org/project/KubeDiagrams/${{ github.event.release.name }}
|
|
steps:
|
|
- name: Retrieve release distributions
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: release-dists
|
|
path: dist/
|
|
|
|
- name: Publish release distributions to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
packages-dir: dist/
|
|
|
|
build-publish-images:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Extract version from release tag
|
|
id: get_version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
|
|
|
|
- name: Build and push Docker multi-arch image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ secrets.DOCKERHUB_USERNAME }}/kubediagrams:${{ env.VERSION }}
|
|
${{ secrets.DOCKERHUB_USERNAME }}/kubediagrams:latest
|