9
9
jobs :
10
10
ubuntu :
11
11
runs-on : ubuntu-latest
12
+ permissions :
13
+ packages : write
14
+ contents : read
15
+ attestations : write
16
+ id-token : write
12
17
steps :
13
18
- name : Print environment
14
19
shell : bash
18
23
- uses : actions/setup-python@v5
19
24
with :
20
25
python-version : ' 3.10'
26
+ cache : ' pip'
27
+
21
28
- name : Install dependencies
22
29
run : python3 -m pip install -r docker/requirements.txt
23
30
- name : Install opengrok-tools so that pylint can perform the checks
@@ -33,18 +40,46 @@ jobs:
33
40
run : black --check docker/*.py
34
41
- name : Run isort in check mode
35
42
run : isort --settings-file docker/.isort.cfg docker/*.py --check --diff
36
- - name : Build and optionally push Docker image
37
- env :
38
- DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
39
- DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
40
- OPENGROK_REPO_SLUG : ${{ github.repository }}
41
- OPENGROK_REF : ${{ github.ref }}
42
- run : ./dev/docker.sh
43
- - name : Install Python pre-requisites
44
- run : python3 -m pip install requests
45
- - name : Optionally update README on Docker hub
46
- env :
47
- OPENGROK_REPO_SLUG : ${{ github.repository }}
48
- DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
49
- DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
50
- run : ./dev/dockerhub_readme.py
43
+ - name : Login to GitHub Container Registry
44
+ uses : docker/login-action@v3
45
+ with :
46
+ registry : ghcr.io
47
+ username : ${{ github.repository_owner }}
48
+ password : ${{ secrets.GITHUB_TOKEN }}
49
+ - name : Log in to Docker Hub
50
+ uses : docker/login-action@v3
51
+ if : ${{ vars.DOCKER_SLUG != '' }} && ${{ github.event_name != 'pull_request' }}
52
+ with :
53
+ username : ${{ secrets.DOCKER_USERNAME }}
54
+ password : ${{ secrets.DOCKER_PASSWORD }}
55
+ - name : Extract metadata (tags, labels) for Docker
56
+ id : meta
57
+ uses : docker/metadata-action@v5
58
+ with :
59
+ images : |
60
+ ${{ vars.DOCKER_SLUG }}
61
+ ghcr.io/${{ github.repository }}
62
+ labels : |
63
+ maintainer="https://github.com/oracle/opengrok"
64
+ org.opencontainers.image.description="OpenGrok Code Search"
65
+ tags : |
66
+ type=raw,value=latest,enable=${{ github.event_name == 'release' }}
67
+ type=raw,value=master,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
68
+ type=pep440,pattern={{version}},enable=${{ github.event_name == 'release' }}
69
+ type=pep440,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }}
70
+ type=ref,event=branch
71
+ type=ref,event=pr
72
+ - name : Set up QEMU
73
+ uses : docker/setup-qemu-action@v3
74
+ - name : Set up Docker Buildx
75
+ uses : docker/setup-buildx-action@v3
76
+ - name : Build and push Docker image
77
+ id : push
78
+ uses : docker/build-push-action@v6
79
+ with :
80
+ context : .
81
+ file : ./Dockerfile
82
+ platforms : linux/amd64,linux/arm64
83
+ push : ${{ github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/master') }}
84
+ tags : ${{ steps.meta.outputs.tags }}
85
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments