Skip to content

feat: make sensitive fields secret-picker-only #93

feat: make sensitive fields secret-picker-only

feat: make sensitive fields secret-picker-only #93

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
paths:
- "src/**"
- "agent/**"
- "prisma/**"
- "docker/**"
- "package.json"
- "pnpm-lock.yaml"
- "tsconfig.json"
- ".github/workflows/ci.yml"
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
packages: write
env:
REGISTRY: ghcr.io
jobs:
check:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Generate Prisma client
run: npx prisma generate
- name: Lint
run: pnpm lint
- name: Type check
run: npx tsc --noEmit
server-image:
name: Server Image
needs: check
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/terrifiedbug/vectorflow-server
tags: |
type=raw,value=dev,enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
else
echo "value=dev" >> "$GITHUB_OUTPUT"
fi
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: .
file: docker/server/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: VF_VERSION=${{ steps.version.outputs.value }}
cache-from: type=gha
cache-to: type=gha,mode=max
agent-image:
name: Agent Image
needs: check
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/terrifiedbug/vectorflow-agent
tags: |
type=raw,value=dev,enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
- id: version
run: |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
else
echo "value=dev-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
fi
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v6
with:
context: agent
file: agent/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: VERSION=${{ steps.version.outputs.value }}
cache-from: type=gha
cache-to: type=gha,mode=max
agent-dev-binaries:
name: Agent Dev Binaries
needs: check
if: (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')) && !startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
concurrency:
group: dev-release
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: agent/go.sum
- name: Build dev binaries
working-directory: agent
run: |
SHORT_SHA="${GITHUB_SHA::7}"
VERSION="dev-${SHORT_SHA}"
LDFLAGS="-s -w -X github.com/TerrifiedBug/vectorflow/agent/internal/agent.Version=${VERSION}"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ../vf-agent-linux-amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ../vf-agent-linux-arm64 .
echo "${VERSION}" > ../dev-version.txt
- name: Generate checksums
run: sha256sum vf-agent-linux-* > checksums.txt
- name: Publish dev pre-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Delete existing dev release if present (gh errors if not found, ignore)
gh release delete dev --yes --cleanup-tag 2>/dev/null || true
# Create fresh pre-release pointing at current commit
gh release create dev \
--title "Development Build" \
--notes "Rolling dev build from \`${GITHUB_SHA::7}\` on main. Not for production use." \
--target "${GITHUB_SHA}" \
--prerelease \
vf-agent-linux-amd64 \
vf-agent-linux-arm64 \
checksums.txt \
dev-version.txt
agent-binaries:
name: Agent Binaries
needs: check
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache-dependency-path: agent/go.sum
- name: Build binaries
working-directory: agent
run: |
VERSION="${GITHUB_REF_NAME#v}"
LDFLAGS="-s -w -X github.com/TerrifiedBug/vectorflow/agent/internal/agent.Version=${VERSION}"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="${LDFLAGS}" -o ../vf-agent-linux-amd64 .
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="${LDFLAGS}" -o ../vf-agent-linux-arm64 .
- name: Generate checksums
run: sha256sum vf-agent-linux-* > checksums.txt
- uses: actions/upload-artifact@v4
with:
name: agent-binaries
path: |
vf-agent-linux-amd64
vf-agent-linux-arm64
checksums.txt
release:
name: GitHub Release
needs: [server-image, agent-image, agent-binaries]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: agent-binaries
- name: Make binaries executable
run: chmod +x vf-agent-linux-*
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
vf-agent-linux-amd64
vf-agent-linux-arm64
checksums.txt