Skip to content

Commit 30b0b86

Browse files
committed
Add release action
1 parent c958fd7 commit 30b0b86

File tree

7 files changed

+279
-143
lines changed

7 files changed

+279
-143
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
@@ -26,8 +26,9 @@ on:
2626
workflow_call:
2727
workflow_dispatch:
2828

29+
# suffix to avoid cancellation when running from release workflow
2930
concurrency:
30-
group: ${{ github.ref }}-${{ github.workflow }}
31+
group: ${{ github.ref }}-${{ github.workflow }}-databroker-cli
3132
cancel-in-progress: true
3233

3334
# Needed as default_workflow_permissions is "read"
@@ -160,24 +161,36 @@ jobs:
160161
uses: eclipse-kuksa/kuksa-actions/post-container-location@2
161162
with:
162163
image: ttl.sh/eclipse-kuksa/kuksa-databroker-cli-${{github.sha}}
164+
- name: Pack binaries with thirdparty
165+
env:
166+
AMD64_DIR: ${{ github.workspace }}/dist/amd64
167+
ARM64_DIR: ${{ github.workspace }}/dist/arm64
168+
RISCV64_DIR: ${{ github.workspace }}/dist/riscv64
169+
run: |
170+
cd "$AMD64_DIR"
171+
tar czf databroker-cli-amd64.tar.gz *
172+
cd "$ARM64_DIR"
173+
tar czf databroker-cli-arm64.tar.gz *
174+
cd "$RISCV64_DIR"
175+
tar czf databroker-cli-riscv64.tar.gz *
163176
164177
- name: "Archiving AMD64 artifacts"
165178
uses: actions/upload-artifact@v4
166179
with:
167-
name: databroker-cli-amd64
168-
path: ${{github.workspace}}/dist/amd64
180+
name: databroker-cli-amd64.tar.gz
181+
path: ${{github.workspace}}/dist/amd64/databroker-cli-amd64.tar.gz
169182

170183
- name: "Archiving ARM64 artifacts"
171184
uses: actions/upload-artifact@v4
172185
with:
173-
name: databroker-cli-arm64
174-
path: ${{github.workspace}}/dist/arm64
186+
name: databroker-cli-arm64.tar.gz
187+
path: ${{github.workspace}}/dist/arm64/databroker-cli-arm64.tar.gz
175188

176189
- name: "Archiving RISCV64 artifacts"
177190
uses: actions/upload-artifact@v4
178191
with:
179-
name: databroker-cli-riscv64
180-
path: ${{github.workspace}}/dist/riscv64
192+
name: databroker-cli-riscv64.tar.gz
193+
path: ${{github.workspace}}/dist/riscv64/databroker-cli-riscv64.tar.gz
181194

182195

183196
bom:
@@ -200,9 +213,9 @@ jobs:
200213
working-directory: ${{github.workspace}}/createbom
201214
run: |
202215
which cargo-license || cargo install cargo-license
203-
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
216+
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-cli ../databroker
204217
205218
- name: Dash license check
206-
uses: eclipse-kuksa/kuksa-actions/check-dash@2
219+
uses: eclipse-kuksa/kuksa-actions/check-dash@3
207220
with:
208-
dashinput: ${{github.workspace}}/dash-databroker-deps
221+
dashinput: ${{github.workspace}}/dash-databroker-cli

.github/workflows/kuksa_databroker_build.yml

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

23+
# suffix to avoid cancellation when running from release workflow
2324
concurrency:
24-
group: ${{ github.ref }}-${{ github.workflow }}
25+
group: ${{ github.ref }}-${{ github.workflow }}-databroker
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,21 @@ 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+
uses: eclipse-kuksa/kuksa-actions/check-dash@3
300314
with:
301-
dashinput: ${{github.workspace}}/dash-databroker-deps
315+
dashinput: ${{github.workspace}}/dash-databroker
302316
- name: Generate Bill of Materials
303317
working-directory: ${{github.workspace}}/createbom
304318
run: |
305319
rm -r ../databroker/thirdparty
306320
python3 createbom.py ../databroker
307-
cd ..
308-
tar cf thirdparty.tar.gz databroker/thirdparty
321+
cd ../databroker
322+
tar czf thirdparty.tar.gz thirdparty
309323
- name: Upload Bill of Materials
310324
uses: actions/upload-artifact@v4
311325
with:
312326
name: Third party licenses
313-
path: thirdparty.tar.gz
327+
path: databroker/thirdparty.tar.gz
314328
if-no-files-found: error

0 commit comments

Comments
 (0)