mirror of https://github.com/Nonannet/copapy.git
ci: Added auto release for stencils
This commit is contained in:
parent
eb82afface
commit
3fed85ee09
|
|
@ -25,9 +25,51 @@ jobs:
|
||||||
name: stencil-object-files
|
name: stencil-object-files
|
||||||
path: src/copapy/obj/*.o
|
path: src/copapy/obj/*.o
|
||||||
|
|
||||||
|
release-stencils:
|
||||||
|
needs: [build_stencils]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
sparse-checkout: |
|
||||||
|
pyproject.toml
|
||||||
|
tools/get_tag.sh
|
||||||
|
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: stencil-object-files
|
||||||
|
path: src/copapy/obj
|
||||||
|
|
||||||
|
- name: Get version tag name
|
||||||
|
id: version
|
||||||
|
run: bash tools/get_tag.sh
|
||||||
|
|
||||||
|
- name: Release stencils
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -v
|
||||||
|
TAG="${{ steps.version.outputs.version }}"
|
||||||
|
|
||||||
|
if ! gh release view "$TAG" &>/dev/null; then
|
||||||
|
echo "Creating new stencil release $TAG"
|
||||||
|
gh release create "$TAG" src/copapy/obj/*.o \
|
||||||
|
--prerelease \
|
||||||
|
--title "$TAG" \
|
||||||
|
--notes "Automated release stencil for $TAG"
|
||||||
|
else
|
||||||
|
echo "Updating existing release for $TAG"
|
||||||
|
gh release upload "$TAG" src/copapy/obj/*.o --clobber
|
||||||
|
fi
|
||||||
|
|
||||||
build-ubuntu:
|
build-ubuntu:
|
||||||
needs: [build_stencils]
|
needs: [build_stencils]
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,5 @@ RUN apt-get update && apt-get install -y \
|
||||||
gcc-13-riscv64-linux-gnu \
|
gcc-13-riscv64-linux-gnu \
|
||||||
gcc-13-aarch64-linux-gnu \
|
gcc-13-aarch64-linux-gnu \
|
||||||
gcc-13-multilib \
|
gcc-13-multilib \
|
||||||
python3
|
python3 \
|
||||||
|
git
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Check if this run was triggered by a tag
|
||||||
|
if [[ "${GITHUB_REF:-}" == refs/tags/* ]]; then
|
||||||
|
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||||
|
echo "Detected tag push: $TAG_NAME"
|
||||||
|
# For GitHub Actions output
|
||||||
|
echo "version=$TAG_NAME" >> "${GITHUB_OUTPUT:-/dev/stdout}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Otherwise, extract version from pyproject.toml
|
||||||
|
if [[ -f pyproject.toml ]]; then
|
||||||
|
VERSION=$(grep -E '^version\s*=' pyproject.toml \
|
||||||
|
| sed -E 's/version\s*=\s*"([^"]+)"/\1/' \
|
||||||
|
| tr -d '\r\n')
|
||||||
|
if [[ -z "$VERSION" ]]; then
|
||||||
|
echo "! Could not find version in pyproject.toml" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Detected version from pyproject.toml: v$VERSION-beta"
|
||||||
|
echo "version=v$VERSION-beta" >> "${GITHUB_OUTPUT:-/dev/stdout}"
|
||||||
|
else
|
||||||
|
echo "! pyproject.toml not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue