The agent-roles catalog source is no longer hardcoded in app code and no longer supports a local filesystem directory. The provider fetches only from an http(s):// base URL read at runtime from AI_AGENT_ROLES_CATALOG_URL; an empty or non-http value yields a 502 (catalog unavailable). The image ships a per-branch default for that URL (set in CI), still overridable at runtime via the env var. - provider: drop readLocal + node:fs/node:path; readRelative requires http(s) and 502s otherwise; remote fetch/streaming-cap/SSRF guards unchanged. - environment.service: keep AI_AGENT_ROLES_CATALOG_URL (default ''); comment reflects the per-branch build-time default that is runtime-overridable. - Dockerfile: add ARG+ENV AI_AGENT_ROLES_CATALOG_URL in the installer stage as the image default. - CI: develop.yml builds with the develop raw URL; release.yml defines the main raw URL once in workflow env and references it from both build steps. - tests: replace local-fixture tests with remote-mock happy/malformed bundle tests and a non-http => 502 case; path-traversal block uses an https source. - docs: update .env.example, CHANGELOG (#222), agent-roles-catalog/README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
160 lines
4.8 KiB
YAML
160 lines
4.8 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Version tag (e.g. v0.25.3)'
|
|
required: true
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
env:
|
|
VERSION: ${{ inputs.version || github.ref_name }}
|
|
IMAGE: ghcr.io/vvzvlad/gitmost
|
|
AI_AGENT_ROLES_CATALOG_URL: https://raw.githubusercontent.com/vvzvlad/gitmost/main/agent-roles-catalog
|
|
|
|
jobs:
|
|
# Run the reusable test suite first so a failing test blocks the image build.
|
|
test:
|
|
uses: ./.github/workflows/test.yml
|
|
|
|
build:
|
|
needs: test
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- platform: linux/amd64
|
|
runner: ubuntu-latest
|
|
suffix: amd64
|
|
- platform: linux/arm64
|
|
runner: ubuntu-24.04-arm
|
|
suffix: arm64
|
|
runs-on: ${{ matrix.runner }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push by digest
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: ${{ matrix.platform }}
|
|
build-args: |
|
|
APP_VERSION=${{ env.VERSION }}
|
|
AI_AGENT_ROLES_CATALOG_URL=${{ env.AI_AGENT_ROLES_CATALOG_URL }}
|
|
outputs: type=image,name=${{ env.IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
|
cache-from: type=gha,scope=${{ matrix.suffix }}
|
|
cache-to: type=gha,scope=${{ matrix.suffix }},mode=max,ignore-error=true
|
|
|
|
- name: Export digest
|
|
run: |
|
|
mkdir -p /tmp/digests
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
- name: Upload digest
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: digest-${{ matrix.suffix }}
|
|
path: /tmp/digests/*
|
|
if-no-files-found: error
|
|
|
|
- name: Strip v prefix
|
|
id: strip-v
|
|
run: echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Export Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: ${{ matrix.platform }}
|
|
build-args: |
|
|
APP_VERSION=${{ env.VERSION }}
|
|
AI_AGENT_ROLES_CATALOG_URL=${{ env.AI_AGENT_ROLES_CATALOG_URL }}
|
|
push: false
|
|
tags: |
|
|
${{ env.IMAGE }}:latest
|
|
${{ env.IMAGE }}:${{ steps.strip-v.outputs.version }}
|
|
outputs: type=docker,dest=gitmost-${{ matrix.suffix }}.docker.tar
|
|
cache-from: type=gha,scope=${{ matrix.suffix }}
|
|
|
|
- name: Compress image
|
|
run: gzip gitmost-${{ matrix.suffix }}.docker.tar
|
|
|
|
- name: Upload image archive
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: docker-image-${{ matrix.suffix }}
|
|
path: gitmost-${{ matrix.suffix }}.docker.tar.gz
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download digests
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: digest-*
|
|
path: /tmp/digests
|
|
merge-multiple: true
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata for tags
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.IMAGE }}
|
|
tags: |
|
|
type=semver,pattern={{version}},value=${{ env.VERSION }}
|
|
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }},enable=${{ !contains(env.VERSION, '-') }}
|
|
type=raw,value=latest,enable=${{ !contains(env.VERSION, '-') }}
|
|
|
|
- name: Create manifest list and push
|
|
working-directory: /tmp/digests
|
|
run: |
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
|
|
|
- name: Download image archives
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: docker-image-*
|
|
path: /tmp/images
|
|
merge-multiple: true
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ env.VERSION }}
|
|
files: |
|
|
/tmp/images/gitmost-amd64.docker.tar.gz
|
|
/tmp/images/gitmost-arm64.docker.tar.gz
|
|
draft: true
|