mirror of
https://github.com/lbr77/blog-astro.git
synced 2026-06-06 13:41:41 +00:00
Publish frontend Docker image to GHCR
This commit is contained in:
50
.github/workflows/frontend-build.yml
vendored
50
.github/workflows/frontend-build.yml
vendored
@@ -5,6 +5,7 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: frontend-build-${{ github.ref }}
|
group: frontend-build-${{ github.ref }}
|
||||||
@@ -12,32 +13,45 @@ concurrency:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
ASTRO_TELEMETRY_DISABLED: '1'
|
ASTRO_TELEMETRY_DISABLED: '1'
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-push:
|
||||||
name: Build frontend
|
name: Build and push Docker image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Set up Docker Buildx
|
||||||
uses: oven-sh/setup-bun@v2
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
bun-version: 1.3.11
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Extract Docker metadata
|
||||||
run: bun install --frozen-lockfile
|
id: meta
|
||||||
|
uses: docker/metadata-action@v6
|
||||||
- name: Build frontend
|
|
||||||
run: bun run build
|
|
||||||
|
|
||||||
- name: Upload build output
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
with:
|
with:
|
||||||
name: frontend-build-${{ github.run_id }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
path: |
|
tags: |
|
||||||
dist
|
type=raw,value=latest
|
||||||
.vercel/output
|
type=ref,event=branch
|
||||||
if-no-files-found: error
|
type=sha,prefix=sha-
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
Reference in New Issue
Block a user