forked from project-ocre/ocre-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (92 loc) · 3.52 KB
/
Copy pathdevcontainer-linux.yml
File metadata and controls
108 lines (92 loc) · 3.52 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
# @copyright Copyright (c) contributors to Project Ocre,
# which has been established as Project Ocre a Series of LF Projects, LLC
#
# SPDX-License-Identifier: Apache-2.0
name: Linux devcontainer
on:
workflow_call:
outputs:
devcontainer-tag:
value: ${{ jobs.necessary.outputs.devcontainer-tag }}
jobs:
necessary:
name: Necessary?
runs-on: ubuntu-24.04
outputs:
build: ${{ github.event_name == 'workflow_dispatch' || steps.changed-files.outputs.all_changed_and_modified_files != '' }}
devcontainer-tag: ${{ steps.devcontainer-tag.outputs.tag }}
steps:
- name: Clean other workspace
run: rm -rf ../.west
- name: Clean workspace
run: find . -name . -o -prune -exec rm -rf -- {} +
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62
id: changed-files
with:
exclude_submodules: true
files: |
.devcontainer/linux/Dockerfile
- name: Set devcontainer tag
id: devcontainer-tag
run: |
tag=${{ steps.changed-files.outputs.all_changed_and_modified_files != '' && github.ref != 'refs/heads/main' && github.sha || 'latest' }}
echo "tag=$tag" >> $GITHUB_OUTPUT
build-push:
name: Build and push
timeout-minutes: 300
if: ${{ needs.necessary.outputs.build == 'true' }}
needs:
- necessary
strategy:
matrix:
include:
- platform: "amd64"
runner: ubuntu-24.04
- platform: "arm64"
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout the code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Github Registry
uses: docker/login-action@v4
with:
username: ${{ github.actor }}
password: ${{ github.token }}
registry: ghcr.io
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .devcontainer/linux
file: .devcontainer/linux/Dockerfile
target: ocre-ci
push: true
provenance: false
tags: ghcr.io/${{ github.repository }}/devcontainer-linux:${{ needs.necessary.outputs.devcontainer-tag }}-${{ matrix.platform }}
manifest:
if: needs.necessary.outputs.build == 'true'
needs:
- necessary
- build-push
name: Docker manifest
runs-on: ubuntu-24.04
steps:
- name: Login to Github Registry
uses: docker/login-action@v4
with:
username: ${{ github.actor }}
password: ${{ github.token }}
registry: ghcr.io
- name: Create and push multiarch manifests
run: |
docker manifest rm ghcr.io/${{ github.repository }}/devcontainer-linux:${{ needs.necessary.outputs.devcontainer-tag }} || true
docker manifest create \
ghcr.io/${{ github.repository }}/devcontainer-linux:${{ needs.necessary.outputs.devcontainer-tag }} \
ghcr.io/${{ github.repository }}/devcontainer-linux:${{ needs.necessary.outputs.devcontainer-tag }}-amd64 \
ghcr.io/${{ github.repository }}/devcontainer-linux:${{ needs.necessary.outputs.devcontainer-tag }}-arm64
docker manifest push ghcr.io/${{ github.repository }}/devcontainer-linux:${{ needs.necessary.outputs.devcontainer-tag }}