forked from farhoodlabs/paperclip
5499a0b4a6
Change runner from runners-farhoodlabs to ubuntu-latest across all fork workflows. Update container registry from ghcr.io to git.farh.net and authenticate with REGISTRY_TOKEN. Migrate update-infra API calls from GitHub to Gitea. Disable refresh-lockfile.yml (requires GitHub gh CLI). Update CLAUDE.md references. Co-Authored-By: Paperclip <noreply@paperclip.ing>
78 lines
2.3 KiB
YAML
78 lines
2.3 KiB
YAML
name: "Build: Dev"
|
|
|
|
on:
|
|
push:
|
|
branches: [dev]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
outputs:
|
|
image-tag: ${{ steps.tag.outputs.sha }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set image tag
|
|
id: tag
|
|
run: echo "sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.farh.net
|
|
username: ${{ gitea.repository_owner }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: git.farh.net/farhoodlabs/paperclip-dev
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=sha,prefix=
|
|
type=semver,pattern={{version}}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: .farhoodlabs/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
no-cache: true
|
|
|
|
update-infra:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Update dev image tag in infra repo
|
|
run: |
|
|
SHA="${{ needs.build.outputs.image-tag }}"
|
|
FILE="overlays/dev/kustomization.yaml"
|
|
|
|
response=$(curl -sS \
|
|
-H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \
|
|
"https://git.farh.net/api/v1/repos/farhoodlabs/paperclip-infra/contents/$FILE")
|
|
|
|
file_sha=$(echo "$response" | jq -r '.sha')
|
|
content=$(echo "$response" | jq -r '.content' | base64 -d)
|
|
new_content=$(echo "$content" | sed "s/newTag: \".*\"/newTag: \"$SHA\"/")
|
|
encoded=$(printf '%s' "$new_content" | base64 -w 0)
|
|
|
|
curl -sS -X PUT \
|
|
-H "Authorization: token ${{ secrets.REGISTRY_TOKEN }}" \
|
|
"https://git.farh.net/api/v1/repos/farhoodlabs/paperclip-infra/contents/$FILE" \
|
|
-d "{\"message\":\"chore(cd): update paperclip-dev to $SHA\",\"content\":\"$encoded\",\"sha\":\"$file_sha\"}"
|