Skip to content

Commit 308fbb2

Browse files
committed
Add release action
1 parent c958fd7 commit 308fbb2

File tree

5 files changed

+152
-69
lines changed

5 files changed

+152
-69
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# /********************************************************************************
2+
# * Copyright (c) 2024 Contributors to the Eclipse Foundation
3+
# *
4+
# * See the NOTICE file(s) distributed with this work for additional
5+
# * information regarding copyright ownership.
6+
# *
7+
# * This program and the accompanying materials are made available under the
8+
# * terms of the Apache License 2.0 which is available at
9+
# * http://www.apache.org/licenses/LICENSE-2.0
10+
# *
11+
# * SPDX-License-Identifier: Apache-2.0
12+
# ********************************************************************************/
13+
14+
name: Create Draft Release
15+
16+
on:
17+
workflow_dispatch: # input version manually. Overrides push tag
18+
inputs:
19+
tag:
20+
description: "Release version, eg:latest, 0.2.1"
21+
required: true
22+
default: "0.0.0"
23+
24+
# As of today trigger only manually
25+
#push:
26+
# tags:
27+
# - "*.*.*"
28+
29+
# Needed if GITHUB_TOKEN by default do not have right to create release
30+
permissions:
31+
contents: write
32+
packages: write
33+
34+
jobs:
35+
get_version:
36+
runs-on: ubuntu-latest
37+
# Map a step output to a job output
38+
outputs:
39+
version: ${{ steps.eval_version.outputs.version }}
40+
steps:
41+
- name: Get tag or user release version
42+
id: eval_version
43+
run: |
44+
GIT_VER="${GITHUB_REF/refs\/tags\//}"
45+
echo "### Detected tag: $GIT_VER"
46+
if [ -n "${{ github.event.inputs.tag }}" ]; then
47+
GIT_VER="${{ github.event.inputs.tag }}"
48+
echo "Forced release version: $GIT_VER"
49+
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
50+
else
51+
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
52+
fi
53+
54+
call_kuksa_databroker_build:
55+
uses: ./.github/workflows/kuksa_databroker_build.yml
56+
call_kuksa_databroker-cli_build:
57+
uses: ./.github/workflows/kuksa_databroker-cli_build.yml
58+
59+
create_release:
60+
runs-on: ubuntu-latest
61+
needs:
62+
[
63+
get_version,
64+
call_kuksa_databroker_build,
65+
call_kuksa_databroker-cli_build,
66+
]
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v4
70+
71+
- name: Download all artifacts
72+
uses: actions/download-artifact@v4
73+
with:
74+
path: build-artifacts
75+
# Only packed binaries shall start with "databroker"
76+
# As of now do not upload separate dash and third party reports
77+
pattern: databroker*
78+
merge-multiple: true
79+
- name: Display structure of downloaded files
80+
run: ls -R build-artifacts
81+
82+
- name: Create release
83+
id: create_release
84+
uses: softprops/action-gh-release@v2
85+
# if: startsWith(github.ref, 'refs/tags/'
86+
with:
87+
draft: true
88+
tag_name: ${{ needs.get_version.outputs.version }}
89+
fail_on_unmatched_files: true
90+
files: |
91+
build-artifacts/*
92+
LICENSE
93+
NOTICE.md

.github/workflows/kuksa_databroker-cli_build.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ on:
2727
workflow_dispatch:
2828

2929
concurrency:
30-
group: ${{ github.ref }}-${{ github.workflow }}
30+
group: ${{ github.ref }}-${{ github.workflow }}-dbcli
3131
cancel-in-progress: true
3232

3333
# Needed as default_workflow_permissions is "read"
@@ -160,24 +160,36 @@ jobs:
160160
uses: eclipse-kuksa/kuksa-actions/post-container-location@2
161161
with:
162162
image: ttl.sh/eclipse-kuksa/kuksa-databroker-cli-${{github.sha}}
163+
- name: Pack binaries with thirdparty
164+
env:
165+
AMD64_DIR: ${{ github.workspace }}/dist/amd64
166+
ARM64_DIR: ${{ github.workspace }}/dist/arm64
167+
RISCV64_DIR: ${{ github.workspace }}/dist/riscv64
168+
run: |
169+
cd "$AMD64_DIR"
170+
tar czf databroker-cli-amd64.tar.gz *
171+
cd "$ARM64_DIR"
172+
tar czf databroker-cli-arm64.tar.gz *
173+
cd "$RISCV64_DIR"
174+
tar czf databroker-cli-riscv64.tar.gz *
163175
164176
- name: "Archiving AMD64 artifacts"
165177
uses: actions/upload-artifact@v4
166178
with:
167-
name: databroker-cli-amd64
168-
path: ${{github.workspace}}/dist/amd64
179+
name: databroker-cli-amd64.tar.gz
180+
path: ${{github.workspace}}/dist/amd64/databroker-cli-amd64.tar.gz
169181

170182
- name: "Archiving ARM64 artifacts"
171183
uses: actions/upload-artifact@v4
172184
with:
173-
name: databroker-cli-arm64
174-
path: ${{github.workspace}}/dist/arm64
185+
name: databroker-cli-arm64.tar.gz
186+
path: ${{github.workspace}}/dist/arm64/databroker-cli-arm64.tar.gz
175187

176188
- name: "Archiving RISCV64 artifacts"
177189
uses: actions/upload-artifact@v4
178190
with:
179-
name: databroker-cli-riscv64
180-
path: ${{github.workspace}}/dist/riscv64
191+
name: databroker-cli-riscv64.tar.gz
192+
path: ${{github.workspace}}/dist/riscv64/databroker-cli-riscv64.tar.gz
181193

182194

183195
bom:
@@ -200,9 +212,10 @@ jobs:
200212
working-directory: ${{github.workspace}}/createbom
201213
run: |
202214
which cargo-license || cargo install cargo-license
203-
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
215+
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-cli ../databroker
204216
205217
- name: Dash license check
206-
uses: eclipse-kuksa/kuksa-actions/check-dash@2
218+
# TODO : use real repo
219+
uses: erikbosch/kuksa-actions/check-dash@main
207220
with:
208-
dashinput: ${{github.workspace}}/dash-databroker-deps
221+
dashinput: ${{github.workspace}}/dash-databroker-cli

.github/workflows/kuksa_databroker_build.yml

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ on:
2020
workflow_call:
2121
workflow_dispatch:
2222

23+
# db/dbcli suffix to group to avoid cancellation when running from release workflow
2324
concurrency:
24-
group: ${{ github.ref }}-${{ github.workflow }}
25+
group: ${{ github.ref }}-${{ github.workflow }}-db
2526
cancel-in-progress: true
2627

2728
# Needed as default_workflow_permissions is "read"
@@ -90,6 +91,7 @@ jobs:
9091
build:
9192
name: Build
9293
runs-on: ubuntu-latest
94+
needs: [bom]
9395
env:
9496
CARGO_TERM_COLOR: always
9597
strategy:
@@ -103,6 +105,14 @@ jobs:
103105
target: riscv64gc-unknown-linux-gnu
104106
steps:
105107
- uses: actions/checkout@v4
108+
- name: Retrieve artifacts
109+
uses: actions/download-artifact@v4
110+
with:
111+
path: artifacts
112+
pattern: Third*
113+
merge-multiple: true
114+
- name: Display structure of downloaded files
115+
run: ls -R
106116
- uses: actions/cache@v4
107117
with:
108118
path: |
@@ -120,19 +130,21 @@ jobs:
120130
working-directory: ${{github.workspace}}/
121131
run: |
122132
cross build --target ${{ matrix.platform.target }} --bin databroker --release
123-
mkdir -p "dist/${{ matrix.platform.name }}"
124-
cp "target/${{ matrix.platform.target }}/release/databroker" "dist/${{ matrix.platform.name }}"
133+
mkdir -p "dist"
134+
cp "target/${{ matrix.platform.target }}/release/databroker" "dist"
125135
- name: Package dist files
126136
shell: bash
127137
working-directory: ${{github.workspace}}
128138
run: |
129-
tar -cf databroker-${{ matrix.platform.name }}.tar.gz dist
139+
cd dist
140+
tar xf ../artifacts/thirdparty.tar.gz
141+
tar -czf databroker-${{ matrix.platform.name }}.tar.gz *
130142
131143
- name: Upload artifacts
132144
uses: actions/upload-artifact@v4
133145
with:
134146
name: databroker-${{ matrix.platform.name }}.tar.gz
135-
path: databroker-${{ matrix.platform.name }}.tar.gz
147+
path: dist/databroker-${{ matrix.platform.name }}.tar.gz
136148
if-no-files-found: error
137149

138150
check_ghcr_push:
@@ -160,16 +172,18 @@ jobs:
160172
ARM64_DIR: ${{ github.workspace }}/target/aarch64-unknown-linux-musl/release
161173
RISCV64_DIR: ${{ github.workspace }}/target/riscv64gc-unknown-linux-gnu/release
162174
run: |
163-
tar xf artifacts/databroker-amd64.tar.gz
175+
cd artifacts
176+
tar xf databroker-amd64.tar.gz
164177
mkdir -p "$AMD64_DIR"
165-
mv dist/amd64/databroker "$AMD64_DIR"
166-
tar xf artifacts/databroker-arm64.tar.gz
178+
mv databroker "$AMD64_DIR"
179+
tar xf databroker-arm64.tar.gz
167180
mkdir -p "$ARM64_DIR"
168-
mv dist/arm64/databroker "$ARM64_DIR"
169-
tar xf artifacts/databroker-riscv64.tar.gz
181+
mv databroker "$ARM64_DIR"
182+
tar xf databroker-riscv64.tar.gz
170183
mkdir -p "$RISCV64_DIR"
171-
mv dist/riscv64/databroker "$RISCV64_DIR"
172-
tar xf artifacts/thirdparty.tar.gz
184+
mv databroker "$RISCV64_DIR"
185+
tar xf thirdparty.tar.gz
186+
mv thirdparty ../databroker/
173187
- name: Set container metadata
174188
id: meta
175189
uses: docker/metadata-action@v5
@@ -294,21 +308,22 @@ jobs:
294308
- name: License check and Dash output generation
295309
working-directory: ${{github.workspace}}/createbom
296310
run: |
297-
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
311+
python3 createbom.py --dash ${{github.workspace}}/dash-databroker ../databroker
298312
- name: Dash license check
299-
uses: eclipse-kuksa/kuksa-actions/check-dash@2
313+
# TODO : use real repo
314+
uses: erikbosch/kuksa-actions/check-dash@main
300315
with:
301-
dashinput: ${{github.workspace}}/dash-databroker-deps
316+
dashinput: ${{github.workspace}}/dash-databroker
302317
- name: Generate Bill of Materials
303318
working-directory: ${{github.workspace}}/createbom
304319
run: |
305320
rm -r ../databroker/thirdparty
306321
python3 createbom.py ../databroker
307-
cd ..
308-
tar cf thirdparty.tar.gz databroker/thirdparty
322+
cd ../databroker
323+
tar czf thirdparty.tar.gz thirdparty
309324
- name: Upload Bill of Materials
310325
uses: actions/upload-artifact@v4
311326
with:
312327
name: Third party licenses
313-
path: thirdparty.tar.gz
328+
path: databroker/thirdparty.tar.gz
314329
if-no-files-found: error

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ COPY ./target/riscv64gc-unknown-linux-gnu/release/databroker /app/databroker
4444
FROM target-$TARGETARCH as target
4545
ARG TARGETARCH
4646

47+
48+
# Before running this file thirdparty files must have been created
49+
# by build-all-targets.sh or corresponding command in buildaction
4750
COPY ./databroker/thirdparty/ /app/thirdparty
4851

4952
COPY ./data/vss-core/vss_release_3.1.1.json vss_release_3.1.1.json

prepare_release.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)