mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-16 23:02:08 +08:00
Skip build on ci
This commit is contained in:
28
.github/workflows/docker-publish.yml
vendored
28
.github/workflows/docker-publish.yml
vendored
@@ -64,6 +64,16 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ env.IMAGE_NAME }}
|
||||||
|
ghcr.io/${{ env.IMAGE_NAME }}
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
|
||||||
- name: Next.js build cache
|
- name: Next.js build cache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
@@ -87,9 +97,12 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
# Build Next.js app
|
|
||||||
- name: Build Next.js app
|
- name: Build Next.js app
|
||||||
run: pnpm run build
|
run: |
|
||||||
|
NEXT_PUBLIC_BUILDTIME="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}" \
|
||||||
|
NEXT_PUBLIC_VERSION="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" \
|
||||||
|
NEXT_PUBLIC_REVISION="${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}" \
|
||||||
|
pnpm run build
|
||||||
|
|
||||||
# Docker logins
|
# Docker logins
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
@@ -113,16 +126,6 @@ jobs:
|
|||||||
- name: Setup Docker buildx
|
- name: Setup Docker buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ env.IMAGE_NAME }}
|
|
||||||
ghcr.io/${{ env.IMAGE_NAME }}
|
|
||||||
flavor: |
|
|
||||||
latest=auto
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
@@ -132,6 +135,7 @@ jobs:
|
|||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
build-args: |
|
build-args: |
|
||||||
|
CI=true
|
||||||
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
BUILDTIME=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
||||||
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
||||||
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
REVISION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||||
|
|||||||
@@ -19,7 +19,14 @@ ARG REVISION
|
|||||||
|
|
||||||
# Build only if needed (local use)
|
# Build only if needed (local use)
|
||||||
RUN pnpm run telemetry \
|
RUN pnpm run telemetry \
|
||||||
&& NEXT_PUBLIC_BUILDTIME=$BUILDTIME NEXT_PUBLIC_VERSION=$VERSION NEXT_PUBLIC_REVISION=$REVISION pnpm run build
|
&& if [ "$CI" != "true" ]; then \
|
||||||
|
NEXT_PUBLIC_BUILDTIME=$BUILDTIME \
|
||||||
|
NEXT_PUBLIC_VERSION=$VERSION \
|
||||||
|
NEXT_PUBLIC_REVISION=$REVISION \
|
||||||
|
pnpm run build; \
|
||||||
|
else \
|
||||||
|
echo "Skipping build in CI (already built)"; \
|
||||||
|
fi
|
||||||
|
|
||||||
# Final runtime image
|
# Final runtime image
|
||||||
FROM docker.io/node:22-alpine AS runner
|
FROM docker.io/node:22-alpine AS runner
|
||||||
|
|||||||
Reference in New Issue
Block a user