• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: "Build/Push container"
2description: "Build a BCC CI container and push it when not a pull-request."
3
4inputs:
5  os_distro:
6    description: "OS Disctribution. Ex: ubuntu"
7    required: true
8  os_version:
9    description: "Version of the OS. Ex: 20.04"
10    required: true
11  os_nick:
12    description: "Nickname of the OS. Ex: focal"
13    required: true
14  registry:
15    description: "Registry where to push images"
16    default: ghcr.io
17  password:
18    description: "Password used to log into the docker registry."
19  push:
20    description: "Whether or not to push the build image"
21    type: boolean
22    default: false
23
24runs:
25  using: "composite"
26  steps:
27    # Login against registry except on PR
28    # https://github.com/docker/login-action
29    - name: Log into registry ${{ inputs.registry }}
30      if: ${{ inputs.push == 'true' && github.event_name != 'pull_request' }}
31
32      uses: docker/login-action@v2
33      with:
34        registry: ${{ inputs.registry }}
35        username: ${{ github.actor }}
36        password: ${{ inputs.password }}
37
38    - name: Build and push
39      uses: docker/build-push-action@v3
40      with:
41        push: ${{ inputs.push == 'true' && github.event_name != 'pull_request' }}
42        build-args: |
43          VERSION=${{ inputs.os_version }}
44          SHORTNAME=${{ inputs.os_nick }}
45        file: docker/build/Dockerfile.${{ inputs.os_distro }}
46        tags: ${{ inputs.registry }}/${{ github.repository }}:${{ inputs.os_distro }}-${{ inputs.os_version }}
47
48