-
Notifications
You must be signed in to change notification settings - Fork 89
145 lines (122 loc) · 3.96 KB
/
Copy pathbuild.yml
File metadata and controls
145 lines (122 loc) · 3.96 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---
# yamllint disable rule:line-length
name: "build"
on: # yamllint disable-line rule:truthy
push:
branches: [master]
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: false
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
check-docker-files:
name: Check for updated docker files
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Get changed docker files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: docker/**
docker:
name: Build the container
runs-on: ubuntu-latest
needs: check-docker-files
if: ${{ needs.check-docker-files.outputs.changed == 'true' }}
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
packages: write # Required to push image to ghcr.io
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
flavor: latest=true
tags: |
type=ref,event=branch
type=sha
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
platforms: linux/amd64
context: docker
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
collect:
name: Collect DEVFAMILY and OS combinations
runs-on: ubuntu-latest
needs: docker
if: ${{ !failure() && !cancelled() }}
container:
image: ghcr.io/texasinstruments/processor-sdk-doc:latest
options: --entrypoint /bin/bash
outputs:
build-matrix: "${{ steps.matrix.outputs.matrix }}"
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Create build matrix
id: matrix
run: |
./bin/build_matrix.py
build:
name: Build
runs-on: ubuntu-latest
container:
image: ghcr.io/texasinstruments/processor-sdk-doc:latest
options: --entrypoint /bin/bash
needs: collect
if: ${{ !failure() && !cancelled() }}
strategy:
matrix:
include: "${{ fromJSON(needs.collect.outputs.build-matrix) }}"
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Add directory to safe dir overrides
run: |
git config --global --add safe.directory "$PWD"
- name: Build ${{ matrix.device }}
env:
DEVFAMILY: ${{ matrix.device }}
OS: ${{ matrix.os }}
run: |
make VERSION=${GITHUB_REF_NAME}
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.device }}-${{ matrix.os }}
path: build/
retention-days: 1