File: container.yml

package info (click to toggle)
xdg-native-messaging-proxy 0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 256 kB
  • sloc: ansic: 886; python: 259; xml: 34; sh: 16; makefile: 6
file content (59 lines) | stat: -rw-r--r-- 1,857 bytes parent folder | download | duplicates (2)
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
env:
  IMAGE_TAG: 2025.03.26-6

on:
  workflow_call:
    outputs:
      image:
        description: "The build image"
        value: ${{ jobs.build-container.outputs.image }}
      image_options:
        description: "The options to use with the image"
        value: --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined --privileged

jobs:
  build-container:
    name: Create build container
    runs-on: ubuntu-latest

    outputs:
      image: ${{ steps.check.outputs.image }}

    steps:
      - name: Login to GHCR
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ github.token }}

      - name: Check if image already exists on GHCR
        id: check
        run: |
          ACTOR="${{ github.actor }}"
          OWNER="${{ github.repository_owner }}"
          image_actor="ghcr.io/${ACTOR,,}/xdg-native-messaging-proxy:${{ env.IMAGE_TAG }}"
          image_owner="ghcr.io/${OWNER,,}/xdg-native-messaging-proxy:${{ env.IMAGE_TAG }}"

          if docker manifest inspect "${image_owner}" >/dev/null ; then
            echo "exists=true" >> "$GITHUB_OUTPUT"
            echo "image=${image_owner}" >> "$GITHUB_OUTPUT"
            exit 0
          fi

          if docker manifest inspect "${image_actor}" >/dev/null ; then
            echo "exists=true" >> "$GITHUB_OUTPUT"
            echo "image=${image_actor}" >> "$GITHUB_OUTPUT"
            exit 0
          fi

          echo "exists=false" >> "$GITHUB_OUTPUT"
          echo "image=${image_owner}" >> "$GITHUB_OUTPUT"

      - name: Build and push
        if: ${{ steps.check.outputs.exists == 'false' }}
        uses: docker/build-push-action@v5
        with:
          push: true
          file: .github/workflows/Containerfile
          tags: ${{ steps.check.outputs.image }}