Update testbuild.yml #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Production build | ||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x, 22.x] | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
- name: Install dependencies | ||
run: yarn install && yarn add autoprefixer | ||
- name: Build the Next.js project | ||
run: | | ||
echo "🚀 Starting build..." | ||
yarn build || (echo "❌ Build failed! Full logs:" && cat .next/output.log && exit 1) | ||
# Docker steps will only run for Node.js 22.x | ||
- name: Log in to GitHub Container Registry | ||
if: matrix.node-version == '22.x' | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
- name: Build Docker image | ||
if: matrix.node-version == '22.x' | ||
run: | | ||
Check failure on line 43 in .github/workflows/testbuild.yml GitHub Actions / Production buildInvalid workflow file
|
||
echo "🐳 Building Docker image..." | ||
docker build -t ghcr.io/${{ github.repository_owner | toLowerCase() }}/${{ github.repository | toLowerCase() }}:latest . | ||
- name: Push Docker image to GHCR | ||
if: matrix.node-version == '22.x' | ||
run: | | ||
echo "📦 Pushing Docker image to GitHub Container Registry..." | ||
docker push ghcr.io/${{ github.repository_owner | toLowerCase() }}/${{ github.repository | toLowerCase() }}:latest |