Standardize CI/CD: use homelab-frontend pattern (REGISTRY_PAT, docker:27-cli, all repos)
ci / markdown (push) Waiting to run

This commit is contained in:
Story Crater Bot
2026-08-23 16:05:18 -07:00
parent dcb684e3e2
commit 5bda2b71e4
5 changed files with 603 additions and 109 deletions
+38 -28
View File
@@ -8,7 +8,7 @@ on:
env:
REGISTRY: forgejo.riotpiao.com
IMAGE_NAME: rock/poimen-memory
IMAGE: forgejo.riotpiao.com/rock/poimen-memory
jobs:
test:
@@ -17,39 +17,49 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run cargo build
run: cargo build --workspace
- name: Run cargo test
- name: Run tests
run: cargo test --all
build-image:
name: Build and Push Image
runs-on: rust
build:
name: Build and push image
runs-on: golang
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
container:
image: docker:27-cli
volumes:
- /docker-certs/client:/docker-certs/client:ro
env:
DOCKER_HOST: tcp://localhost:2376
DOCKER_TLS_VERIFY: "1"
DOCKER_CERT_PATH: /docker-certs/client
steps:
- name: install node (required by JS-based actions)
run: apk add --no-cache nodejs git
- uses: actions/checkout@v4
- name: Build Docker image
- name: Get short SHA
id: sha
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
- name: Registry login
run: |
echo "${REGISTRY_PAT}" | docker login "${REGISTRY}" \
--username rock --password-stdin
env:
REGISTRY_PAT: ${{ secrets.REGISTRY_PAT }}
- name: Build
run: |
docker build \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \
-f Dockerfile .
echo "Built images:"
docker images | grep "${{ env.IMAGE_NAME }}"
- name: Login to registry and push
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
-t "${IMAGE}:latest" \
.
- name: Push
run: |
# Use Forgejo's actor token which has registry access
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login ${{ env.REGISTRY }} \
-u ${{ github.actor }} --password-stdin
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
echo "Image pushed: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE}:latest"