[Fix] Windows workflow senza Node.js e PowerShell Core
Build and Push Docker Images / Build Windows Container (push) Failing after -1s
Build and Push Docker Images / Create Multi-Platform Manifest (push) Has been cancelled
Build and Push Docker Images / Build Linux Container (push) Has started running

- Rimosso uso di GitHub Actions che richiedono Node.js
- Checkout manuale con git invece di actions/checkout
- Login Docker diretto invece di docker/login-action
- Build e push con script CMD nativo Windows
- Fix: Cannot find pwsh/node in PATH
This commit is contained in:
2026-01-24 13:39:04 +01:00
parent 263ae063ac
commit ee7f925fb3
+29 -56
View File
@@ -99,71 +99,44 @@ jobs:
packages: write packages: write
steps: steps:
- name: Setup Node.js for Actions - name: Checkout repository (manual git)
run: | run: |
# Check if node is available git config --global core.autocrlf false
if (!(Get-Command node -ErrorAction SilentlyContinue)) { git clone --depth 1 --branch ${{ github.ref_name }} https://github.com/${{ github.repository }} .
Write-Host "Node.js not found, installing..." shell: cmd
choco install nodejs -y --version=20.11.0
refreshenv
}
node --version
shell: pwsh
continue-on-error: false
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
uses: docker/login-action@v3 run: echo ${{ secrets.REGISTRY_TOKEN }} | docker login ${{ env.REGISTRY }} -u alessio --password-stdin
with: shell: cmd
registry: ${{ env.REGISTRY }}
username: alessio
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# Tag based on branch with windows suffix
type=raw,value=latest-windows,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value=latest-windows,enable=${{ github.ref == 'refs/heads/development' }}
type=raw,value=development-latest-windows,enable=${{ github.ref == 'refs/heads/development' }}
type=raw,value=dev-latest-windows,enable=${{ github.ref == 'refs/heads/dev' }}
type=raw,value=staging-latest-windows,enable=${{ github.ref == 'refs/heads/staging' }}
# Tag with commit sha
type=sha,prefix={{branch}}-windows-,format=short
# Tag with date
type=raw,value={{branch}}-windows-{{date 'YYYYMMDD-HHmmss'}}
flavor: |
latest=false
- name: Build and push Windows Docker image - name: Build and push Windows Docker image
run: | run: |
# Convert repository name to lowercase set BRANCH=${{ github.ref_name }}
$imageName = "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}".ToLower() set SHA=${{ github.sha }}
set SHORT_SHA=%SHA:~0,7%
# Build with temporary tag REM Build image
docker build -t "${imageName}:temp-windows" -f Dockerfile.windows . docker build -t temp-image -f Dockerfile.windows .
# Parse and push all tags REM Tag and push based on branch
$tags = "${{ steps.meta.outputs.tags }}" -split "`n" if "%BRANCH%"=="main" (
foreach ($tag in $tags) { docker tag temp-image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-windows
$tag = $tag.Trim() docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-windows
if ($tag) { )
# Ensure tag is lowercase if "%BRANCH%"=="development" (
$tag = $tag.ToLower() docker tag temp-image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-windows
Write-Host "Tagging and pushing: $tag" docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-windows
docker tag "${imageName}:temp-windows" $tag docker tag temp-image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:development-latest-windows
docker push $tag docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:development-latest-windows
} )
} if "%BRANCH%"=="staging" (
docker tag temp-image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-latest-windows
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-latest-windows
)
# Remove temporary tag REM Clean up
docker rmi "${imageName}:temp-windows" docker rmi temp-image
shell: pwsh shell: cmd
create-manifest: create-manifest:
name: Create Multi-Platform Manifest name: Create Multi-Platform Manifest