Debian Codegraph @

.github/workflows/container.yml

raw
1 env:
2 IMAGE_TAG: 20250213-1
3
4 on:
5 workflow_call:
6 outputs:
7 image:
8 description: "The build image"
9 value: ${{ jobs.build-container.outputs.image }}
10 image_options:
11 description: "The options to use with the image"
12 value: --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined --privileged
13
14 jobs:
15 build-container:
16 name: Create build container
17 runs-on: ubuntu-latest
18
19 outputs:
20 image: ${{ steps.check.outputs.image }}
21
22 steps:
23 - name: Login to GHCR
24 uses: docker/login-action@v3
25 with:
26 registry: ghcr.io
27 username: ${{ github.actor }}
28 password: ${{ github.token }}
29
30 - name: Check if image already exists on GHCR
31 id: check
32 run: |
33 ACTOR="${{ github.actor }}"
34 OWNER="${{ github.repository_owner }}"
35 image_actor="ghcr.io/${ACTOR,,}/xdg-desktop-portal:${{ env.IMAGE_TAG }}"
36 image_owner="ghcr.io/${OWNER,,}/xdg-desktop-portal:${{ env.IMAGE_TAG }}"
37
38 if docker manifest inspect "${image_owner}" >/dev/null ; then
39 echo "exists=true" >> "$GITHUB_OUTPUT"
40 echo "image=${image_owner}" >> "$GITHUB_OUTPUT"
41 exit 0
42 fi
43
44 if docker manifest inspect "${image_actor}" >/dev/null ; then
45 echo "exists=true" >> "$GITHUB_OUTPUT"
46 echo "image=${image_actor}" >> "$GITHUB_OUTPUT"
47 exit 0
48 fi
49
50 echo "exists=false" >> "$GITHUB_OUTPUT"
51 echo "image=${image_owner}" >> "$GITHUB_OUTPUT"
52
53 - name: Build and push
54 if: ${{ steps.check.outputs.exists == 'false' }}
55 uses: docker/build-push-action@v5
56 with:
57 push: true
58 file: .github/workflows/Containerfile
59 tags: ${{ steps.check.outputs.image }}