Files
portfolio/.github/workflows/build.yml
denshooter a7d636bff4 Dev (#47)
* 🚀 refactor: simplify deployment process in workflow file

* 🚀 chore: add IMAGE_NAME to GITHUB_ENV for deployment workflow

*  chore: simplify deployment logging in workflow file

* 🚀 fix: correct container name in deployment script logic

* 🚀 refactor: rename job and streamline deployment steps

* Update README.md

*  fix: prevent multiple form submissions in Contact component

*  feat: honeypot and timestamp checks to form submission

*  refactor: simplify contact form and improve UI elements

*  feat: add responsive masonry layout for projects display

*  style: Update project title size and improve layout visibility

*  fix: remove unnecessary test assertions and improve act usage

*  chore: add @types/react-responsive-masonry package

fixing with this import error on building

*  chore: remove unused dev dependencies from package-lock.json

*  refactor: update environment variable usage and add caching

*  refactor: update environment variables and dependencies

*  chore: streamline Dockerfile and remove redundant steps
2025-02-23 17:39:04 +01:00

41 lines
1.2 KiB
YAML

name: Build and Push Docker Image
on:
workflow_run:
workflows: ["Test Code Base"]
types:
- completed
branches:
- production
- dev
- preview
jobs:
build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Create Deployment .env File
run: |
cat > .env <<EOF
NEXT_PUBLIC_BASE_URL=${{ vars.NEXT_PUBLIC_BASE_URL }}
GHOST_API_URL=${{ vars.GHOST_API_URL }}
GHOST_API_KEY=${{ secrets.GHOST_API_KEY }}
MY_EMAIL=${{ vars.MY_EMAIL }}
MY_PASSWORD=${{ secrets.MY_PASSWORD }}
EOF
echo "Created .env file:" && cat .env
- name: Build & Push Docker Image
run: |
# Nutzt den Branch-Namen aus dem auslösenden Workflow
IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/my-nextjs-app:${{ github.event.workflow_run.head_branch }}"
docker buildx create --use
docker buildx build --platform linux/arm64 -t "$IMAGE_NAME" --push .