-
Notifications
You must be signed in to change notification settings - Fork 537
78 lines (67 loc) · 2.37 KB
/
docker-publish-xcomp.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Cross-Compile Docker
on:
push:
branches: [ main ]
paths:
- .github/workflows/docker-publish-xcomp.yml
- .docker/ubuntu-20.04/*
- .docker/ubuntu-22.04/*
- .docker/ubuntu-24.04/*
pull_request:
branches: [ main ]
paths:
- .github/workflows/docker-publish-xcomp.yml
- .docker/ubuntu-20.04/*
- .docker/ubuntu-22.04/*
- .docker/ubuntu-24.04/*
permissions: read-all
env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}/linux-build-xcomp
jobs:
build:
strategy:
fail-fast: false
matrix:
version: ['20.04', '22.04', '24.04']
target: ['cross']
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: .docker/ubuntu-${{ matrix.version }}
file: .docker/ubuntu-${{ matrix.version }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:ubuntu-${{ matrix.version }}-${{ matrix.target }}
labels: ${{ steps.meta.outputs.labels }}
target: ${{ matrix.target }}-build