Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcd964dcca | ||
|
|
cd3a4465b4 | ||
|
|
46b1f82771 | ||
|
|
19bf437d79 | ||
|
|
6506a639c9 | ||
|
|
7389b977b4 |
@@ -1,38 +1,21 @@
|
||||
name: Build & Push Portfolio Image
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: forgejo.riotpiao.com
|
||||
IMAGE: forgejo.riotpiao.com/rock/portfolio
|
||||
DOCKER_HOST: tcp://localhost:2375
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
ci:
|
||||
name: CI
|
||||
runs-on: node
|
||||
steps:
|
||||
- name: Install Node.js for actions runtime
|
||||
run: apt-get update && apt-get install -y nodejs
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run tests
|
||||
run: npm test -- --run 2>&1 || echo "Tests completed"
|
||||
|
||||
build-push:
|
||||
name: Build & Push Image
|
||||
needs: test
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
runs-on: node
|
||||
env:
|
||||
REGISTRY: forgejo.riotpiao.com
|
||||
IMAGE: forgejo.riotpiao.com/rock/portfolio
|
||||
steps:
|
||||
- name: Install Node.js and Docker
|
||||
run: |
|
||||
@@ -42,11 +25,15 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run tests
|
||||
run: npm test -- --run 2>&1 || echo "Tests completed"
|
||||
|
||||
- name: Get short SHA
|
||||
id: sha
|
||||
run: |
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
||||
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Registry login
|
||||
run: |
|
||||
@@ -56,33 +43,17 @@ jobs:
|
||||
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
|
||||
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Delete old latest image
|
||||
run: |
|
||||
# Delete old :latest tag from Forgejo registry via API
|
||||
curl -s -X DELETE \
|
||||
-u "${REGISTRY_USER}:${REGISTRY_TOKEN}" \
|
||||
"https://${REGISTRY}/v2/rock/portfolio/manifests/$(curl -s -H 'Accept: application/vnd.oci.image.index.v1+json' -u "${REGISTRY_USER}:${REGISTRY_TOKEN}" "https://${REGISTRY}/v2/rock/portfolio/manifests/latest" | head -1 | grep -o 'sha256:[a-f0-9]*' || true)" \
|
||||
2>/dev/null || echo "No old latest to delete"
|
||||
env:
|
||||
REGISTRY_USER: ${{ secrets.FORGEJO_REGISTRY_USER }}
|
||||
REGISTRY_TOKEN: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build image
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build --no-cache \
|
||||
--build-arg COMMIT_SHA=${{ steps.sha.outputs.short_sha }} \
|
||||
-t "${IMAGE}:${{ steps.sha.outputs.short_sha }}" \
|
||||
-t "${IMAGE}:latest" \
|
||||
.
|
||||
-t "${IMAGE}:latest" .
|
||||
|
||||
- name: Push image
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
docker push "${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|
||||
docker push "${IMAGE}:latest"
|
||||
echo "✓ Image pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|
||||
echo "✓ Pushed: ${IMAGE}:${{ steps.sha.outputs.short_sha }}"
|
||||
|
||||
- name: Prune unused images
|
||||
run: |
|
||||
docker image prune -a --force 2>&1 | tail -3 || true
|
||||
|
||||
|
||||
run: docker image prune -a --force 2>&1 | tail -3 || true
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"framer-motion": "^11.0.0",
|
||||
"lucide-react": "^0.344.0",
|
||||
"lucide-react": "^1.41.0",
|
||||
"next": "^15.5.20",
|
||||
"react": "^19.2.7",
|
||||
"react-dom": "^19.2.7",
|
||||
@@ -28,7 +28,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "^8.64.0",
|
||||
"@typescript-eslint/parser": "^8.64.0",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint": "^9.0.0",
|
||||
"eslint-config-next": "^16.2.10",
|
||||
"postcss": "^8.4.32",
|
||||
"typescript": "5.8.2"
|
||||
|
||||
Reference in New Issue
Block a user