66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: Build & Push Portfolio Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'app/**'
|
|
- 'components/**'
|
|
- 'lib/**'
|
|
- 'public/**'
|
|
- 'styles/**'
|
|
- 'package.json'
|
|
- 'pnpm-lock.yaml'
|
|
- 'next.config.js'
|
|
- 'tsconfig.json'
|
|
- 'Dockerfile'
|
|
- '.dockerignore'
|
|
|
|
jobs:
|
|
build-push:
|
|
runs-on: golang
|
|
container:
|
|
image: docker:27-cli
|
|
volumes:
|
|
- /docker-certs/client:/docker-certs/client:ro
|
|
env:
|
|
DOCKER_HOST: tcp://localhost:2376
|
|
DOCKER_TLS_VERIFY: "1"
|
|
DOCKER_CERT_PATH: /docker-certs/client
|
|
REGISTRY: forgejo.riotpiao.com
|
|
IMAGE: forgejo.riotpiao.com/rock/portfolio
|
|
steps:
|
|
- name: Install git
|
|
run: apk add --no-cache git nodejs
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get short SHA
|
|
id: sha
|
|
run: |
|
|
SHORT_SHA=$(git rev-parse --short HEAD)
|
|
echo "short_sha=${SHORT_SHA}" >> $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 image
|
|
run: |
|
|
docker build \
|
|
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
|
|
-t "${IMAGE}:latest" \
|
|
.
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|
|
docker push "${IMAGE}:latest"
|
|
echo "✓ Image pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|