Skip to content

Merge pull request #4 from canonical/renovate/canonical-setup-lxd-0.x #8

Merge pull request #4 from canonical/renovate/canonical-setup-lxd-0.x

Merge pull request #4 from canonical/renovate/canonical-setup-lxd-0.x #8

# The workflow canonical/observability/.github/workflows/rock-release-dev.yaml@main
# https://github.com/canonical/observability/blob/34b7edb56094e8e3f01200ce49e01bf9dd6688ac/.github/workflows/rock-release-dev.yaml
# does not allow setting a GHCR repo where to publish at the moment.
# We thus copy it below and adapt it.
name: Build ROCK and release dev or branch tag to GHCR
on:
workflow_dispatch:
push:
branches:
- main
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Find the *latest* rockcraft.yaml
id: find-latest
run: |
latest_rockcraft_file=$(find $GITHUB_WORKSPACE -name "rockcraft.yaml" | sort -V | tail -n1)
rockcraft_dir=$(dirname ${latest_rockcraft_file#\./})
echo "latest-dir=$rockcraft_dir" >> $GITHUB_OUTPUT
- name: Build ROCK
uses: canonical/craft-actions/rockcraft-pack@main
with:
path: "${{ steps.find-latest.outputs.latest-dir }}"
verbosity: verbose
id: rockcraft
- name: Upload locally built ROCK artifact
uses: actions/upload-artifact@v4
with:
name: ros2bag-fileserver
path: ${{ steps.rockcraft.outputs.rock }}
retention-days: 7
- name: Upload ROCK to ghcr.io
run: |
if [[ ${{ github.ref }} == 'refs/heads/main' ]]
then
TAG=dev
else
TAG=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
TAG=$(echo $TAG | sed "s|\/|\_|")
fi
sudo skopeo --insecure-policy copy oci-archive:$(realpath ${{ steps.rockcraft.outputs.rock }}) docker://ghcr.io/canonical/ros2bag-fileserver:$TAG --dest-creds "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}"
- name: Generate digest
run: |
digest=$(skopeo inspect oci-archive:$(realpath ${{ steps.rockcraft.outputs.rock }}) --format '{{.Digest}}')
echo "digest=${digest#*:}" >> "$GITHUB_OUTPUT"
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
- name: Create SBOM
run: syft $(realpath ${{ steps.rockcraft.outputs.rock }}) -o spdx-json=ros2bag-fileserver.sbom.json
- name: Upload SBOM
uses: actions/upload-artifact@v4
with:
name: ros2bag-fileserver-sbom
path: "ros2bag-fileserver.sbom.json"