Skip to content

coordinate v29 upgrade #5

coordinate v29 upgrade

coordinate v29 upgrade #5

name: DEV - Build and Push to GHCR
on:
pull_request:
types:
- closed
branches:
- dev
permissions:
contents: write
pull-requests: write
packages: write
env:
IMAGE_NAME: coordinatecore
ENV_TYPE: dev
jobs:
build-and-push:
name: Build and Push Docker Image
if: ${{ github.event.pull_request.merged == true }}
runs-on: governance-testenv-github-self-hosted
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Cache CMake build
uses: actions/cache@v3
with:
path: |
build
~/.cache
key: ${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('**/*.cpp', '**/*.h') }}
restore-keys: |
${{ runner.os }}-cmake-${{ hashFiles('**/CMakeLists.txt') }}-
${{ runner.os }}-cmake-
- name: Cache apt packages
uses: actions/cache@v3
with:
path: /var/cache/apt/archives
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/*.yml') }}
restore-keys: |
${{ runner.os }}-apt-
- name: Create new tag (semantic versioning)
id: tag
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: dev,main
default_bump: patch # can be major/minor/patch
- name: Set lowercase owner name
id: lowercase
run: |
echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Install Dependencies
run: |
# Wait for apt lock to be released
while sudo fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do
echo "Waiting for other apt processes to finish..."
sleep 5
done
sudo apt-get update && sudo apt-get install -y \
build-essential \
cmake \
libtool \
autotools-dev \
automake \
pkg-config \
bsdmainutils \
python3 \
libevent-dev \
libboost-dev \
libsqlite3-dev \
libminiupnpc-dev \
libnatpmp-dev \
libzmq3-dev \
systemtap-sdt-dev \
curl
- name: Configure with CMake
run: cmake -B build -DWITH_ZMQ=ON
- name: Build with CMake
run: cmake --build build
- name: Verify build artifacts
run: ls -la build/bin/
- name: Fix Docker socket permissions
run: |
sudo chmod 666 /var/run/docker.sock
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.tag.outputs.new_tag }}
type=raw,value=latest
type=ref,event=branch
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ steps.lowercase.outputs.owner }}/${{ env.IMAGE_NAME }}:buildcache,mode=max