feat: split Gitea workflow into test/build/push jobs
Build and Push Docker Image / test (push) Successful in 30s
Build and Push Docker Image / build (push) Failing after 44s
Build and Push Docker Image / push (push) Has been skipped

This commit is contained in:
hwinkel
2026-05-09 12:32:36 +02:00
parent 0e62f0f80b
commit f155a7952a
+93 -5
View File
@@ -10,10 +10,9 @@ env:
IMAGE_NAME: ${{ gitea.repository }} IMAGE_NAME: ${{ gitea.repository }}
jobs: jobs:
build: test:
permissions: permissions:
contents: read contents: read
packages: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -32,6 +31,26 @@ jobs:
- name: Run tests - name: Run tests
run: npm run test run: npm run test
build:
permissions:
contents: read
packages: write
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -51,10 +70,79 @@ jobs:
type=sha,prefix=,format=short type=sha,prefix=,format=short
type=raw,value=latest,enable={{is_default_branch}} type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push - name: Build and load Docker image
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
push: true load: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
- name: Save Docker image
run: |
mkdir -p ./docker-image
IMAGE_ID=$(docker images -q ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest)
docker save $IMAGE_ID -o ./docker-image/image.tar
- name: Upload Docker image
uses: actions/upload-artifact@v4
with:
name: docker-image
path: ./docker-image/image.tar
push:
permissions:
contents: read
packages: write
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Download Docker image artifact
uses: actions/download-artifact@v4
with:
name: docker-image
path: ./docker-image
- name: Load Docker image
run: |
IMAGE_ID=$(docker load -i ./docker-image/image.tar --format '{{.ID}}')
echo "Loaded image: $IMAGE_ID"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ gitea.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=,format=short
type=raw,value=latest,enable={{is_default_branch}}
- name: Push Docker image
uses: docker/build-push-action@v6
with:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true