Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release action #10

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/create_draft_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# /********************************************************************************
# * Copyright (c) 2024 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/

name: Create Draft Release

on:
workflow_dispatch: # input version manually. Overrides push tag
inputs:
tag:
description: "Release version, eg:latest, 0.2.1"
required: true
default: "0.0.0"

# As of today trigger only manually
#push:
# tags:
# - "*.*.*"

# Needed if GITHUB_TOKEN by default do not have right to create release
permissions:
contents: write
packages: write

jobs:
get_version:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
version: ${{ steps.eval_version.outputs.version }}
steps:
- name: Get tag or user release version
id: eval_version
run: |
GIT_VER="${GITHUB_REF/refs\/tags\//}"
echo "### Detected tag: $GIT_VER"
if [ -n "${{ github.event.inputs.tag }}" ]; then
GIT_VER="${{ github.event.inputs.tag }}"
echo "Forced release version: $GIT_VER"
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
else
echo "version=${GIT_VER}" >> $GITHUB_OUTPUT
fi
call_kuksa_databroker_build:
uses: ./.github/workflows/kuksa_databroker_build.yml
call_kuksa_databroker-cli_build:
uses: ./.github/workflows/kuksa_databroker-cli_build.yml

create_release:
runs-on: ubuntu-latest
needs:
[
get_version,
call_kuksa_databroker_build,
call_kuksa_databroker-cli_build,
]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: build-artifacts
# Only packed binaries shall start with "databroker"
# As of now do not upload separate dash and third party reports
pattern: databroker*
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R build-artifacts

- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
# if: startsWith(github.ref, 'refs/tags/'
with:
draft: true
tag_name: ${{ needs.get_version.outputs.version }}
fail_on_unmatched_files: true
files: |
build-artifacts/*
LICENSE
NOTICE.md
33 changes: 23 additions & 10 deletions .github/workflows/kuksa_databroker-cli_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ on:
workflow_call:
workflow_dispatch:

# suffix to avoid cancellation when running from release workflow
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
group: ${{ github.ref }}-${{ github.workflow }}-databroker-cli
cancel-in-progress: true

# Needed as default_workflow_permissions is "read"
Expand Down Expand Up @@ -160,24 +161,36 @@ jobs:
uses: eclipse-kuksa/kuksa-actions/post-container-location@2
with:
image: ttl.sh/eclipse-kuksa/kuksa-databroker-cli-${{github.sha}}
- name: Pack binaries with thirdparty
env:
AMD64_DIR: ${{ github.workspace }}/dist/amd64
ARM64_DIR: ${{ github.workspace }}/dist/arm64
RISCV64_DIR: ${{ github.workspace }}/dist/riscv64
run: |
cd "$AMD64_DIR"
tar czf databroker-cli-amd64.tar.gz *
cd "$ARM64_DIR"
tar czf databroker-cli-arm64.tar.gz *
cd "$RISCV64_DIR"
tar czf databroker-cli-riscv64.tar.gz *

- name: "Archiving AMD64 artifacts"
uses: actions/upload-artifact@v4
with:
name: databroker-cli-amd64
path: ${{github.workspace}}/dist/amd64
name: databroker-cli-amd64.tar.gz
path: ${{github.workspace}}/dist/amd64/databroker-cli-amd64.tar.gz

- name: "Archiving ARM64 artifacts"
uses: actions/upload-artifact@v4
with:
name: databroker-cli-arm64
path: ${{github.workspace}}/dist/arm64
name: databroker-cli-arm64.tar.gz
path: ${{github.workspace}}/dist/arm64/databroker-cli-arm64.tar.gz

- name: "Archiving RISCV64 artifacts"
uses: actions/upload-artifact@v4
with:
name: databroker-cli-riscv64
path: ${{github.workspace}}/dist/riscv64
name: databroker-cli-riscv64.tar.gz
path: ${{github.workspace}}/dist/riscv64/databroker-cli-riscv64.tar.gz


bom:
Expand All @@ -200,9 +213,9 @@ jobs:
working-directory: ${{github.workspace}}/createbom
run: |
which cargo-license || cargo install cargo-license
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-cli ../databroker

- name: Dash license check
uses: eclipse-kuksa/kuksa-actions/check-dash@2
uses: eclipse-kuksa/kuksa-actions/check-dash@3
with:
dashinput: ${{github.workspace}}/dash-databroker-deps
dashinput: ${{github.workspace}}/dash-databroker-cli
50 changes: 32 additions & 18 deletions .github/workflows/kuksa_databroker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ on:
workflow_call:
workflow_dispatch:

# suffix to avoid cancellation when running from release workflow
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
group: ${{ github.ref }}-${{ github.workflow }}-databroker
cancel-in-progress: true

# Needed as default_workflow_permissions is "read"
Expand Down Expand Up @@ -90,6 +91,7 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
needs: [bom]
env:
CARGO_TERM_COLOR: always
strategy:
Expand All @@ -103,6 +105,14 @@ jobs:
target: riscv64gc-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Retrieve artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: Third*
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R
- uses: actions/cache@v4
with:
path: |
Expand All @@ -120,19 +130,21 @@ jobs:
working-directory: ${{github.workspace}}/
run: |
cross build --target ${{ matrix.platform.target }} --bin databroker --release
mkdir -p "dist/${{ matrix.platform.name }}"
cp "target/${{ matrix.platform.target }}/release/databroker" "dist/${{ matrix.platform.name }}"
mkdir -p "dist"
cp "target/${{ matrix.platform.target }}/release/databroker" "dist"
- name: Package dist files
shell: bash
working-directory: ${{github.workspace}}
run: |
tar -cf databroker-${{ matrix.platform.name }}.tar.gz dist
cd dist
tar xf ../artifacts/thirdparty.tar.gz
tar -czf databroker-${{ matrix.platform.name }}.tar.gz *

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: databroker-${{ matrix.platform.name }}.tar.gz
path: databroker-${{ matrix.platform.name }}.tar.gz
path: dist/databroker-${{ matrix.platform.name }}.tar.gz
if-no-files-found: error

check_ghcr_push:
Expand Down Expand Up @@ -160,16 +172,18 @@ jobs:
ARM64_DIR: ${{ github.workspace }}/target/aarch64-unknown-linux-musl/release
RISCV64_DIR: ${{ github.workspace }}/target/riscv64gc-unknown-linux-gnu/release
run: |
tar xf artifacts/databroker-amd64.tar.gz
cd artifacts
tar xf databroker-amd64.tar.gz
mkdir -p "$AMD64_DIR"
mv dist/amd64/databroker "$AMD64_DIR"
tar xf artifacts/databroker-arm64.tar.gz
mv databroker "$AMD64_DIR"
tar xf databroker-arm64.tar.gz
mkdir -p "$ARM64_DIR"
mv dist/arm64/databroker "$ARM64_DIR"
tar xf artifacts/databroker-riscv64.tar.gz
mv databroker "$ARM64_DIR"
tar xf databroker-riscv64.tar.gz
mkdir -p "$RISCV64_DIR"
mv dist/riscv64/databroker "$RISCV64_DIR"
tar xf artifacts/thirdparty.tar.gz
mv databroker "$RISCV64_DIR"
tar xf thirdparty.tar.gz
mv thirdparty ../databroker/
- name: Set container metadata
id: meta
uses: docker/metadata-action@v5
Expand Down Expand Up @@ -294,21 +308,21 @@ jobs:
- name: License check and Dash output generation
working-directory: ${{github.workspace}}/createbom
run: |
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
python3 createbom.py --dash ${{github.workspace}}/dash-databroker ../databroker
- name: Dash license check
uses: eclipse-kuksa/kuksa-actions/check-dash@2
uses: eclipse-kuksa/kuksa-actions/check-dash@3
with:
dashinput: ${{github.workspace}}/dash-databroker-deps
dashinput: ${{github.workspace}}/dash-databroker
- name: Generate Bill of Materials
working-directory: ${{github.workspace}}/createbom
run: |
rm -r ../databroker/thirdparty
python3 createbom.py ../databroker
cd ..
tar cf thirdparty.tar.gz databroker/thirdparty
cd ../databroker
tar czf thirdparty.tar.gz thirdparty
- name: Upload Bill of Materials
uses: actions/upload-artifact@v4
with:
name: Third party licenses
path: thirdparty.tar.gz
path: databroker/thirdparty.tar.gz
if-no-files-found: error
Loading
Loading