Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
86929fa
added compilation instruction
MMarcus95 Jul 1, 2026
4a3a7ef
added readme
MMarcus95 Jul 1, 2026
ab2ea39
added project
MMarcus95 Jul 1, 2026
7326230
added templates for create and clean releases
MMarcus95 Jul 1, 2026
e3d7e2f
added build to .gitignore
MMarcus95 Jul 1, 2026
34aa743
stand-alone compilation enabled
MMarcus95 Jul 1, 2026
fba51f7
testing default build of cicd
MMarcus95 Jul 1, 2026
dced791
simplify idls set for fast cicd test
MMarcus95 Jul 1, 2026
1542fc7
debug first cicd
MMarcus95 Jul 1, 2026
7984064
avoiding submodule dowloand of dls2 when compiling
MMarcus95 Jul 1, 2026
eb4d585
release-on-push test - wip
MMarcus95 Jul 1, 2026
0bb0dda
update action for release and fix asset files
MMarcus95 Jul 1, 2026
bff9795
cleanup
MMarcus95 Jul 1, 2026
6f5e814
restoring all the dls2 msgs
MMarcus95 Jul 1, 2026
693e6b6
fixing asset upload
MMarcus95 Jul 2, 2026
ef07e83
creating cmake cofnig package for dls_messages
MMarcus95 Jul 2, 2026
6a12fc5
removed version info from deb package
MMarcus95 Jul 2, 2026
f96f0e1
asset is now the deb package
MMarcus95 Jul 2, 2026
bd5d73a
temp chage for quick cicd test
MMarcus95 Jul 2, 2026
bb54648
remove unused output for runtime .deb artifact in create_release work…
MMarcus95 Jul 2, 2026
028b818
fixing package creation for cicd
MMarcus95 Jul 2, 2026
f847bdb
debug debian creation in cicd
MMarcus95 Jul 2, 2026
e3cd17a
testing debian package generation
MMarcus95 Jul 3, 2026
f53d1ff
testing cicd
MMarcus95 Jul 3, 2026
4d6d71a
test debian packagin - almost there
MMarcus95 Jul 3, 2026
61c6706
using docker image in package-deb
MMarcus95 Jul 3, 2026
881e9d0
using source tree for debian package
MMarcus95 Jul 3, 2026
055c036
refactoring cicd
MMarcus95 Jul 3, 2026
fc481bc
fixed job depencency cicd
MMarcus95 Jul 3, 2026
ac212c9
fixed deb name
MMarcus95 Jul 3, 2026
9023aa8
fixed deb path
MMarcus95 Jul 3, 2026
24f6dbd
fixed deb info
MMarcus95 Jul 3, 2026
9f423cf
fixing deb name for release
MMarcus95 Jul 3, 2026
12be426
restoring all messages
MMarcus95 Jul 3, 2026
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/cleanup-temp-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Cleanup Temporary Branch Releases when Pull Request is Merged

on:
pull_request:
types:
- closed
branches:
- main

permissions:
contents: write
pull-requests: read

jobs:
cleanup-temp-releases:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Normalize merged branch name
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"

SAFE_BRANCH="${BRANCH_NAME//\//-}"
SAFE_BRANCH="${SAFE_BRANCH//_/-}"
SAFE_BRANCH="$(echo "$SAFE_BRANCH" | tr '[:upper:]' '[:lower:]')"

echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
echo "SAFE_BRANCH=$SAFE_BRANCH" >> "$GITHUB_ENV"

echo "Merged branch: $BRANCH_NAME"
echo "Safe branch: $SAFE_BRANCH"

- name: Delete all temporary releases and tags for merged branch
run: |
set -euo pipefail

PREFIX="temp-${SAFE_BRANCH}-v"

echo "Repository: ${GITHUB_REPOSITORY}"
echo "Looking for temp releases with prefix: ${PREFIX}"

gh api \
--paginate \
"repos/${GITHUB_REPOSITORY}/releases" \
--jq '.[] | [.id, .tag_name] | @tsv' \
> releases.tsv

echo "All release tags currently visible:"
cut -f2 releases.tsv || true

MATCHES="$(
awk -v prefix="$PREFIX" '
BEGIN { prefix_len = length(prefix) }
index($2, prefix) == 1 {
suffix = substr($2, prefix_len + 1)
if (suffix ~ /^[0-9]+$/) {
print $1 "\t" $2
}
}
' releases.tsv
)"

if [ -z "$MATCHES" ]; then
echo "No matching temporary releases found for branch: ${BRANCH_NAME}"
echo "Expected tags like: ${PREFIX}1, ${PREFIX}2, ${PREFIX}3"
exit 0
fi

echo "Matching releases to delete:"
echo "$MATCHES"

echo "$MATCHES" | while IFS="$(printf '\t')" read -r RELEASE_ID TAG; do
if [ -z "$RELEASE_ID" ] || [ -z "$TAG" ]; then
continue
fi

echo "Deleting release id=${RELEASE_ID}, tag=${TAG}"

gh api \
--method DELETE \
"repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}"

echo "Deleting git tag ref: ${TAG}"

gh api \
--method DELETE \
"repos/${GITHUB_REPOSITORY}/git/refs/tags/${TAG}" \
|| echo "Tag ${TAG} was already deleted or did not exist"
done
154 changes: 154 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Create Release

on:
push:
branches:
- "**"

jobs:
build_test_package:
runs-on: ubuntu-latest
container:
image: ghcr.io/iit-dlslab/dls2-dev:latest
credentials:
username: ${{ secrets.GHCR_USERNAME || github.actor }}
password: ${{ secrets.CICD_PAT || github.token }}
steps:
- uses: actions/checkout@v4
with:
set-safe-directory: true
submodules: recursive
token: ${{ secrets.CICD_PAT || github.token }}
- name: Configure git credentials for cmake FetchContent
shell: bash
env:
CICD_PAT: ${{ secrets.CICD_PAT }}
run: |
set -euo pipefail
TOKEN="${CICD_PAT:-$GITHUB_TOKEN}"
git config --global url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/"
- name: Build package
shell: bash
run: |
set -euo pipefail

mkdir build && cd build
cmake ..
make -j$(nproc) package

echo "Generated packages:"
ls -lh *.deb
- name: Upload .deb artifact
uses: actions/upload-artifact@v4
with:
name: dls-messages-deb
path: build/dls-messages-dev.deb
if-no-files-found: error

release-on-push:
runs-on: ubuntu-latest
needs: build_test_package

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
set-safe-directory: true

- name: Normalize branch name
run: |
SAFE_BRANCH="${GITHUB_REF_NAME//\//-}"
SAFE_BRANCH="${SAFE_BRANCH//_/-}"
SAFE_BRANCH="$(echo "$SAFE_BRANCH" | tr '[:upper:]' '[:lower:]')"

echo "SAFE_BRANCH=$SAFE_BRANCH" >> "$GITHUB_ENV"

- name: Download dev .deb artifact
uses: actions/download-artifact@v4
with:
name: dls-messages-deb
path: debs

- name: Download runtime .deb artifact
uses: actions/download-artifact@v4
with:
name: dls-messages-deb
path: debs

- name: Compute release tag
run: |
git fetch --tags --force

if [ "$GITHUB_REF_NAME" = "main" ]; then
LAST_VERSION="$(
git tag --list 'v[0-9]*.[0-9]*.[0-9]*' \
| sed 's/^v//' \
| grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \
| sort -V \
| tail -n 1
)"

if [ -z "$LAST_VERSION" ]; then
NEXT_VERSION="0.1.0"
else
MAJOR="$(echo "$LAST_VERSION" | cut -d. -f1)"
MINOR="$(echo "$LAST_VERSION" | cut -d. -f2)"
PATCH="$(echo "$LAST_VERSION" | cut -d. -f3)"

MINOR=$((MINOR + 1))
PATCH=0

NEXT_VERSION="${MAJOR}.${MINOR}.${PATCH}"
fi

RELEASE_TAG="v${NEXT_VERSION}"
else
PREFIX="temp-${SAFE_BRANCH}-v"

LAST_NUMBER="$(
git tag --list "${PREFIX}*" \
| sed "s/^${PREFIX}//" \
| grep -E '^[0-9]+$' \
| sort -n \
| tail -n 1
)"

if [ -z "$LAST_NUMBER" ]; then
NEXT_NUMBER=1
else
NEXT_NUMBER=$((LAST_NUMBER + 1))
fi

RELEASE_TAG="${PREFIX}${NEXT_NUMBER}"
fi

echo "RELEASE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"
echo "Computed release tag: $RELEASE_TAG"

- name: Create main GitHub release and upload assets
if: github.ref_name == 'main'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
target_commitish: ${{ github.sha }}
files: debs/*.deb
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create branch GitHub release and upload assets
if: github.ref_name != 'main'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
target_commitish: ${{ github.sha }}
files: debs/*.deb
make_latest: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@

# debug information files
*.dwo

# build directory
build
Loading
Loading