-
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (52 loc) · 2.1 KB
/
build-version.yml
File metadata and controls
60 lines (52 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Build Python Version
on:
workflow_call:
inputs:
version:
description: "Specific version (major.minor.patch[suffix]) of Python to build"
required: true
type: string
tag:
description: "Version tag to apply to Docker image (e.g. 3.14, 3.14j)"
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
name: Build Python ${{ inputs.version }}
concurrency:
group: build-python-${{ inputs.version }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Git commit short SHA
id: git-sha
run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
cache-to: type=inline
cache-from: type=registry,ref=ghcr.io/python-discord/python-builds:${{ inputs.tag }}
labels: |
org.opencontainers.image.source=https://github.com/python-discord/python-builds
org.opencontainers.image.description="Python ${{ inputs.version }} Docker image maintained by Python Discord."
org.opencontainers.image.licenses=MIT
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Python ${{ inputs.version }} Docker image maintained by Python Discord.
tags: |
ghcr.io/python-discord/python-builds:${{ inputs.tag }}
ghcr.io/python-discord/python-builds:${{ inputs.version }}
ghcr.io/python-discord/python-builds:${{ inputs.tag }}-${{ steps.git-sha.outputs.sha }}
build-args: |
PYTHON_VERSION=${{ inputs.version }}