forked from project-ocre/ocre-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (61 loc) · 2.11 KB
/
devcontainer-linux.yml
File metadata and controls
74 lines (61 loc) · 2.11 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
# @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: ["self-hosted", "build-server"]
outputs:
build: ${{ 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@v4
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
if: ${{ needs.necessary.outputs.build == 'true' }}
needs:
- necessary
runs-on: ["self-hosted", "build-server"]
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github Registry
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ github.token }}
registry: ghcr.io
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .devcontainer/linux
file: .devcontainer/linux/Dockerfile
target: ocre-ci
push: true
tags: ghcr.io/${{ github.repository }}/devcontainer-linux:${{ needs.necessary.outputs.devcontainer-tag }}