Compare commits

..
1 Commits
Author SHA1 Message Date
rock 56438e7751 ci: split PR check and deploy workflows
PR Check / Build & Test (pull_request) Failing after 6s
build.yaml: PR-only, runs build+test+clippy (no Docker)
deploy.yaml: main+dispatch only, builds+pushes Docker image
  - Skips build/test/clippy (already passed in PR)
  - Tags with short SHA + latest
  - Uses FORGEJO_REGISTRY_USER/TOKEN secrets
2026-09-08 19:10:25 -07:00
2 changed files with 17 additions and 42 deletions
+3 -35
View File
@@ -5,53 +5,21 @@ on:
branches: [main]
env:
REGISTRY: forgejo.riotpiao.com
IMAGE: forgejo.riotpiao.com/riotpiao-poimen/poimen-memory
DOCKER_HOST: tcp://localhost:2375
SQLX_OFFLINE: "true"
jobs:
check:
name: Build, Test & Image
name: Build & Test
runs-on: rust
steps:
- name: Install Docker
run: apt-get update && apt-get install -y docker.io
- name: Checkout code
uses: actions/checkout@v4
- name: Cargo build
- name: Cargo build all
run: cargo build --all --verbose
- name: Cargo test
- name: Cargo test all
run: cargo test --all --lib --verbose 2>&1 | tail -150 || true
- name: Cargo clippy
run: cargo clippy --all --all-targets -- -D warnings 2>&1 | tail -50 || true
- name: Clean build artifacts
run: cargo clean
- name: Get short SHA
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Registry login
run: |
echo "${REGISTRY_TOKEN}" | docker login "${REGISTRY}" \
--username "${REGISTRY_USER}" --password-stdin
env:
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
- name: Build and push image (SHA tag only)
run: |
docker build --no-cache --progress=plain \
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
-f Dockerfile .
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
echo "Pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
- name: Prune images
run: docker image prune -a --force 2>&1 | tail -3 || true
+14 -7
View File
@@ -9,10 +9,11 @@ env:
REGISTRY: forgejo.riotpiao.com
IMAGE: forgejo.riotpiao.com/riotpiao-poimen/poimen-memory
DOCKER_HOST: tcp://localhost:2375
SQLX_OFFLINE: "true"
jobs:
deploy:
name: Tag & Push Latest
name: Build & Push Image
runs-on: rust
steps:
- name: Install Docker
@@ -33,12 +34,18 @@ jobs:
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
- name: Pull SHA image and tag as latest
- name: Build Docker image
run: |
docker pull "${IMAGE}:${{ steps.sha.outputs.short_sha }}" && \
docker tag "${IMAGE}:${{ steps.sha.outputs.short_sha }}" "${IMAGE}:latest" && \
docker push "${IMAGE}:latest" && \
echo "Tagged and pushed: ${IMAGE}:latest (from ${{ steps.sha.outputs.short_sha }})"
docker build --no-cache --progress=plain \
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
-t "${IMAGE}:latest" \
-f Dockerfile .
- name: Prune images
- name: Push Docker image
run: |
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
docker push "${IMAGE}:latest"
echo "Pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
- name: Prune unused images
run: docker image prune -a --force 2>&1 | tail -3 || true