diff options
-rw-r--r-- | .github/workflows/release.yml | 43 | ||||
-rw-r--r-- | Dockerfile | 6 |
2 files changed, 49 insertions, 0 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9e1c6fc..f7911a55 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -101,3 +101,46 @@ jobs: files: dist/*.tar.gz fail_on_unmatched_files: true draft: true + + build-and-push-docker-image: + if: startsWith(github.ref, 'refs/tags/') + needs: ["deploy"] + runs-on: ubuntu-latest + environment: release + + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Scrape build info + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/pkgcore/pkgcheck + tags: | + type=semver,pattern={{version}} + type=sha + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + PKGCHECK_VERSION=${{ env.RELEASE_VERSION }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..42c3b37d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3-slim +ARG PKGCHECK_VERSION + +RUN apt-get update && apt-get install -y git && \ + rm -rf /var/lib/apt/lists/ /var/cache/apt && \ + pip install pkgcheck==${PKGCHECK_VERSION} setuptools |