Skip to content

Commit 3ea705a

Browse files
author
Dominic Sudy
committed
wip
1 parent 8fa5669 commit 3ea705a

File tree

3 files changed

+133
-17
lines changed

3 files changed

+133
-17
lines changed

.github/workflows/release.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Copyright (c) 2023 Robert Bosch GmbH
2+
#
3+
# This program and the accompanying materials are made available under the
4+
# terms of the Apache License, Version 2.0 which is available at
5+
# https://www.apache.org/licenses/LICENSE-2.0.
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
#
13+
# SPDX-License-Identifier: Apache-2.0
14+
15+
name: Release
16+
17+
on:
18+
push:
19+
tags:
20+
- 'v[0-9]+\.[0-9]+\.[0-9]+'
21+
22+
workflow_dispatch:
23+
24+
jobs:
25+
wait-for-images:
26+
runs-on: ubuntu-latest
27+
name: Wait for container images
28+
29+
steps:
30+
- name: Wait for build-base-images workflow to succeed
31+
uses: fountainhead/[email protected]
32+
with:
33+
checkName: Building image
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
timeoutSeconds: 5400
36+
intervalSeconds: 120
37+
38+
initialize-matrix:
39+
runs-on: ubuntu-latest
40+
name: Setting up build matrix
41+
needs: [wait-for-images]
42+
43+
steps:
44+
- name: Login to GitHub Container Registry
45+
uses: docker/login-action@v2
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.repository_owner }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- id: github-repository-name-case-adjusted
52+
name: Prepare repository name in lower case for docker upload.
53+
uses: ASzc/change-string-case-action@v5
54+
with:
55+
string: ${{ github.repository }}
56+
57+
- uses: docker/setup-buildx-action@v2
58+
id: buildx
59+
with:
60+
install: true
61+
62+
- name: Get version from tag
63+
id: getVersions
64+
run: |
65+
semantic_version=$(sed -e "s/^v//" <<< ${{ github.ref_name }})
66+
major_version=$(cut -d '.' -f 1 <<< "$semantic_version")
67+
major_minor_version=$(cut -d '.' -f 1,2 <<< "$semantic_version")
68+
echo "semantic_version=v$semantic_version" >> $GITHUB_OUTPUT
69+
echo "major_version=v$major_version" >> $GITHUB_OUTPUT
70+
echo "major_minor_version=v$major_minor_version" >> $GITHUB_OUTPUT
71+
72+
- name: Tag docker images
73+
run: |
74+
FQ_IMAGE_NAME=ghcr.io/${{ steps.github-repository-name-case-adjusted.outputs.lowercase }}/app-builder
75+
OLD_TAG=${{ github.sha }}
76+
V_XXX=${{ steps.getVersions.outputs.semantic_version }}
77+
V_X=${{ steps.getVersions.outputs.major_version }}
78+
V_XX=${{ steps.getVersions.outputs.major_minor_version }}
79+
80+
if [[ $V_XX != "v0.0" ]] ; then
81+
docker buildx imagetools create -t $FQ_IMAGE_NAME:$V_XX $FQ_IMAGE_NAME:$OLD_TAG
82+
if [[ $V_X != "v0" ]] ; then
83+
docker buildx imagetools create -t $FQ_IMAGE_NAME:$V_X $FQ_IMAGE_NAME:$OLD_TAG
84+
fi
85+
fi
86+
87+
docker buildx imagetools create -t $FQ_IMAGE_NAME:$V_XXX $FQ_IMAGE_NAME:$OLD_TAG

.github/workflows/sdk-build-container.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 Robert Bosch GmbH
1+
# Copyright (c) 2022-2023 Robert Bosch GmbH
22
#
33
# This program and the accompanying materials are made available under the
44
# terms of the Apache License, Version 2.0 which is available at
@@ -12,25 +12,24 @@
1212
#
1313
# SPDX-License-Identifier: Apache-2.0
1414

15-
name: SDK - Build Base Container
15+
name: SDK - App Builder
1616
concurrency:
17-
group: sdk-build-container-${{ github.ref }}
17+
group: sdk-app-builder-${{ github.ref }}
1818
cancel-in-progress: true
1919

2020
on:
2121
workflow_dispatch:
2222
push:
2323
branches:
24-
- "main"
25-
release:
26-
types: [published, edited]
24+
- main
25+
pull_request:
26+
branches:
27+
- main
2728

2829
jobs:
2930
build-container:
31+
name: Building image
3032
runs-on: ubuntu-latest
31-
#strategy:
32-
# matrix:
33-
# platform: [amd64, aarch64]
3433

3534
steps:
3635
- name: Checkout repository
@@ -49,20 +48,50 @@ jobs:
4948
username: ${{ github.repository_owner }}
5049
password: ${{ secrets.GITHUB_TOKEN }}
5150

51+
- id: github-repository-name-case-adjusted
52+
name: Prepare repository name in lower case for docker upload.
53+
uses: ASzc/change-string-case-action@v5
54+
with:
55+
string: ${{ github.repository }}
56+
5257
- name: Extract metadata (tags, labels) for Docker
5358
id: meta
5459
uses: docker/metadata-action@v4
5560
with:
5661
images: |
5762
ghcr.io/${{ github.repository }}
5863
59-
- name: "Build image"
64+
- name: Get image tag
65+
id: get-tag
66+
shell: bash
67+
run: |
68+
TAGS=${{ github.sha }}
69+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
70+
TAGS="${TAGS},latest"
71+
fi
72+
echo "tag=${{ github.sha }}" >> $GITHUB_OUTPUT
73+
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
74+
75+
- name: Set container output type
76+
id: container_output
77+
shell: bash
78+
run: |
79+
if [ ${{ github.event }} = "push" ]; then
80+
echo "type=registry" >> $GITHUB_OUTPUT
81+
else
82+
echo "type=oci,dest=./container.tar" >> $GITHUB_OUTPUT
83+
fi
84+
85+
- name: Build image
6086
id: image_build
6187
uses: docker/[email protected]
6288
with:
89+
imageName: ghcr.io/${{ steps.github-repository-name-case-adjusted.outputs.lowercase }}/app-builder
90+
imageTag: ${{ steps.get-tag.outputs.tags }}
6391
push: true
6492
file: sdk/Dockerfile
6593
platforms: linux/amd64
66-
tags: ${{ steps.meta.outputs.tags }}
6794
labels: ${{ steps.meta.outputs.labels }}
95+
outputs: |
96+
type=${{ steps.container_output.outputs.type }}
6897
context: .

sdk/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ COPY . /sdk
3535

3636
RUN --mount=type=cache,target=/root/.conan
3737

38-
RUN cd /sdk && \
39-
./install_dependencies.sh -r --build-all-deps && \
40-
cd / && rm -rf /sdk
38+
#RUN cd /sdk && \
39+
# ./install_dependencies.sh -r --build-all-deps && \
40+
# cd / && rm -rf /sdk
4141

4242
# install CLI
43-
RUN git clone https://github.com/eclipse-velocitas/cli.git && \
44-
cd cli && \
45-
npm i && npm run build && npx oclif manifest && npm i -g .
43+
#RUN git clone https://github.com/eclipse-velocitas/cli.git && \
44+
# cd cli && \
45+
# npm i && npm run build && npx oclif manifest && npm i -g .

0 commit comments

Comments
 (0)