-
Notifications
You must be signed in to change notification settings - Fork 541
76 lines (65 loc) · 2.31 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
name: Cross-Compile Docker
on:
push:
branches: [ main ]
paths:
- .github/workflows/docker-publish-xcomp.yml
- .docker/ubuntu-20.04/*
- .docker/ubuntu-22.04/*
pull_request:
branches: [ main ]
paths:
- .github/workflows/docker-publish-xcomp.yml
- .docker/ubuntu-20.04/*
- .docker/ubuntu-22.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']
target: ['x86_64', 'arm']
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
# 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@343f7c4344506bcbf9b4de18042ae17996df046d
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@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
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