-
Notifications
You must be signed in to change notification settings - Fork 9
78 lines (71 loc) · 2.81 KB
/
build.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
name: Build
on: [push, pull_request, workflow_dispatch]
jobs:
config:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"type\":\"amd64\",\"image\":\"amazon/aws-lambda-provided:al2\", \"arch\":\"x86_64\"},{\"type\":\"arm64\",\"image\":\"amazon/aws-lambda-provided:al2.2023.12.14.13\", \"arch\":\"arm64\"}] }"
containers:
needs: config
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix: ${{fromJson(needs.config.outputs.matrix)}}
env:
PUSH_PACKAGES: ${{ github.repository_owner == 'PDAL' && github.event_name != 'pull_request'}}
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Lint
id: lint
run: |
echo "are we pushing packages" ${{ env.PUSH_PACKAGES }}
echo "event_name" ${{ github.event_name }}
echo "ref" ${{ github.ref }}
- name: Setup Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- if: ${{ env.PUSH_PACKAGES == 'true' }}
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Prepare
id: prep
run: |
VERSION=sha-${GITHUB_SHA::8}
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF/refs\/tags\//}
fi
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=VERSION::${VERSION}
- name: Build image
uses: docker/build-push-action@v5
with:
push: ${{ env.PUSH_PACKAGES == 'true' }}
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/${{ matrix.type}}
build-args: |
LAMBDA_IMAGE=${{ matrix.image }}
RIE_ARCH=${{ matrix.arch }}
tags: |
ghcr.io/pdal/lambda:${{ steps.prep.outputs.VERSION }}
ghcr.io/pdal/lambda:latest
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}