Use shared ci-actions for docker publish and pages deploy
Some checks failed
Deploy to Pages / deploy (pull_request) Successful in 4s
Build and Publish Docker Image / build-and-push (pull_request) Failing after 15s

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andras Schmelczer 2026-06-06 14:45:54 +01:00
parent 392729c2d4
commit 90f5454edf
2 changed files with 11 additions and 49 deletions

View file

@ -25,7 +25,7 @@ jobs:
- name: Copy frontend to host pages mount - name: Copy frontend to host pages mount
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: | uses: http://forgejo:3000/andras/ci-actions/deploy-pages@main
apt update && apt install -y rsync with:
mkdir -p /pages source: frontend
rsync -a --delete frontend/ /pages/fizika target: fizika

View file

@ -8,9 +8,6 @@ on:
branches: ['main'] branches: ['main']
workflow_dispatch: workflow_dispatch:
env:
IMAGE_NAME: ${{ forgejo.repository }}/fizika-admin
jobs: jobs:
build-and-push: build-and-push:
runs-on: docker runs-on: docker
@ -19,45 +16,10 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: https://code.forgejo.org/actions/checkout@v4 uses: https://code.forgejo.org/actions/checkout@v4
- name: Extract registry host - name: Build and publish admin image
id: registry uses: http://forgejo:3000/andras/ci-actions/docker-publish@main
run: echo "host=$(echo '${{ forgejo.server_url }}' | sed 's|https\?://||')" >> "$GITHUB_OUTPUT" with:
context: ./backend
- name: Log into Forgejo registry image-suffix: /fizika-admin
if: forgejo.event_name != 'pull_request' push: ${{ github.event_name != 'pull_request' }}
run: echo "${{ secrets.FORGEJO_PACKAGE_TOKEN }}" | docker login "${{ steps.registry.outputs.host }}" -u "${{ forgejo.actor }}" --password-stdin token: ${{ secrets.FORGEJO_PACKAGE_TOKEN }}
- name: Build Docker image
run: |
IMAGE="${{ steps.registry.outputs.host }}/$(echo "${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]')"
SHA_SHORT="$(echo "${{ forgejo.sha }}" | cut -c1-12)"
TAG_ARGS="-t ${IMAGE}:sha-${SHA_SHORT}"
if [ "${{ forgejo.ref }}" = "refs/heads/main" ]; then
TAG_ARGS="${TAG_ARGS} -t ${IMAGE}:main -t ${IMAGE}:latest"
fi
if [ "${{ forgejo.ref_type }}" = "tag" ]; then
REF_NAME="${{ forgejo.ref_name }}"
TAG_ARGS="${TAG_ARGS} -t ${IMAGE}:${REF_NAME}"
if echo "$REF_NAME" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
VERSION="${REF_NAME#v}"
MAJOR_MINOR="$(echo "$VERSION" | cut -d. -f1,2)"
MAJOR="$(echo "$VERSION" | cut -d. -f1)"
TAG_ARGS="${TAG_ARGS} -t ${IMAGE}:${VERSION} -t ${IMAGE}:${MAJOR_MINOR} -t ${IMAGE}:${MAJOR}"
fi
fi
docker build \
--label "org.opencontainers.image.source=${{ forgejo.server_url }}/${{ forgejo.repository }}" \
--label "org.opencontainers.image.revision=${{ forgejo.sha }}" \
--label "org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
${TAG_ARGS} \
./backend
echo "IMAGE=${IMAGE}" >> "$GITHUB_ENV"
- name: Push Docker image
if: forgejo.event_name != 'pull_request'
run: docker push --all-tags "$IMAGE"