Skip to content

Add release job

Add release job #4

Workflow file for this run

name: build-archlinuxarm
on:
push:
branches:
- main
tags:
- 'v*'
paths:
- PKGBUILD
- .github/workflows/**
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
tag_from_pkgbuild:
name: Tag from PKGBUILD
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create and push tag from PKGBUILD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
PKGVER=$(sed -n 's/^pkgver=//p' PKGBUILD | head -n1 | tr -d '"'\'' )
PKGREL=$(sed -n 's/^pkgrel=//p' PKGBUILD | head -n1 | tr -d '"'\'' )
if [ -z "${PKGVER}" ] || [ -z "${PKGREL}" ]; then
echo "Failed to parse pkgver/pkgrel from PKGBUILD" >&2
exit 1
fi
TAG="v${PKGVER}-${PKGREL}"
echo "Computed tag: ${TAG}"
if git ls-remote --tags origin | awk '{print $2}' | grep -qx "refs/tags/${TAG}"; then
echo "Tag ${TAG} already exists on remote. Skipping."
exit 0
fi
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a "${TAG}" -m "Release ${TAG}"
# Push using the already-configured credentials from checkout
git push origin "refs/tags/${TAG}"
build:
name: Build package (${{ matrix.pkg_arch }})
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
include:
- platform: linux/arm64
pkg_arch: aarch64
- platform: linux/arm/v7
pkg_arch: armv7h
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build in ArchLinuxARM container
run: |
set -euxo pipefail
docker run --rm \
--platform=${{ matrix.platform }} \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
ghcr.io/ny-a/docker-archlinuxarm:base-devel \
bash -lc '
set -euxo pipefail
pacman -Syu --noconfirm --needed \
git cmake meson boost opencv libcamera libjpeg-turbo libtiff libpng libexif
useradd -m builder
chown -R builder:builder /workspace
sudo -u builder makepkg
'
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: rpicam-apps-${{ matrix.pkg_arch }}
path: "*.pkg.tar.*"
release:
name: Publish release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- name: Download built packages
uses: actions/download-artifact@v4
with:
pattern: rpicam-apps-*
merge-multiple: true
path: dist
- name: List downloaded files
run: ls -lah dist
- name: Create/Update GitHub Release (gh CLI)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
TAG="${GITHUB_REF_NAME}"
# Create the release if it doesn't exist, otherwise continue
gh release view "$TAG" >/dev/null 2>&1 || gh release create "$TAG" --title "$TAG" --generate-notes
# Upload all pkg artifacts as raw files (no additional zipping)
gh release upload "$TAG" dist/*.pkg.tar.* --clobber