-
Notifications
You must be signed in to change notification settings - Fork 6
48 lines (41 loc) · 1.46 KB
/
docker-publish.yml
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
name: Build and Push Docker Image
on:
workflow_dispatch:
release:
types: [ created ] # Runs only when a new release is created
jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'autoatml' && github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12" ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: lowercase github.repository
run: |
echo "IMAGE_NAME=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV}
# Build Docker image with a custom Python version
- name: Build Docker image (Python ${{ matrix.python-version }})
run: |
docker build \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
-t ghcr.io/${{ env.IMAGE_NAME }}/autoplex:python-${{ matrix.python-version }} .
# Push Docker image to GHCR
- name: Push Docker image to GHCR (Python ${{ matrix.python-version }})
run: |
docker push ghcr.io/${{ env.IMAGE_NAME }}/autoplex:python-${{ matrix.python-version }}