# Copyright (C) 2025 Siemens # # SPDX-License-Identifier: MIT name: Publish on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' permissions: contents: read jobs: release-build: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.x" - name: Build release distributions run: | python -m pip install build python -m build - name: Upload distributions uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: release-dists path: dist/ pypi-publish: runs-on: ubuntu-24.04 needs: - release-build permissions: id-token: write # Run only on the official repository (skip forks) if: github.repository == 'siemens/debsbom' environment: name: pypi url: https://pypi.org/project/debsbom/${{ github.ref_name }} steps: - name: Retrieve release distributions uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 with: name: release-dists path: dist/ - name: Publish release distributions to PyPI uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e deploy_containers: name: Build and deploy container images runs-on: ubuntu-24.04 permissions: id-token: write packages: write contents: read attestations: write steps: - name: Check out repo uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Get release run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - name: Set up docker build uses: ./.github/actions/docker-init with: deploy-user: ${{ github.actor }} deploy-token: ${{ secrets.GITHUB_TOKEN }} - name: Find latest tag run: echo "LATEST_TAG=$(git tag | sort --version-sort | tail -n1)" >> $GITHUB_ENV - name: Build image uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 id: push with: context: /home/runner/debsbom-clone target: debsbom platforms: linux/amd64,linux/arm64 build-args: | SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }} DEBIAN_TAG=${{ env.DEBIAN_TAG }} provenance: false outputs: type=registry,rewrite-timestamp=true tags: | ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }} ${{ github.ref_name == env.LATEST_TAG && format('ghcr.io/{0}:latest-release', github.repository) || '' }} annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }} - name: Attest image uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: subject-name: ghcr.io/${{ github.repository }} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true