ci: simplify workflows to use docker CLI only
Some checks failed
Pull Request Validation / validate-pr-title (pull_request) Successful in 0s
Pull Request Validation / validate-docker (pull_request) Failing after 1s
Pull Request Validation / build-test (pull_request) Failing after 1s
Pull Request Validation / check-files (pull_request) Failing after 0s
Some checks failed
Pull Request Validation / validate-pr-title (pull_request) Successful in 0s
Pull Request Validation / validate-docker (pull_request) Failing after 1s
Pull Request Validation / build-test (pull_request) Failing after 1s
Pull Request Validation / check-files (pull_request) Failing after 0s
- remove Node-based actions (checkout, buildx, login, build-push) - rely on gitea workspace checkout and plain docker commands - avoid Node requirement on self-hosted runner
This commit is contained in:
@@ -13,56 +13,26 @@ jobs:
|
||||
build:
|
||||
runs-on: linux
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
echo "Building Docker image..."
|
||||
docker build -t karaokepedia:latest .
|
||||
docker tag karaokepedia:latest karaokepedia:${{ github.sha }}
|
||||
echo "✅ Image built successfully"
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
# Uncomment if using GitHub Container Registry
|
||||
# - name: Log in to GitHub Container Registry
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: ghcr.io
|
||||
# username: ${{ github.actor }}
|
||||
# password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# Uncomment if using Gitea Container Registry
|
||||
# - name: Log in to Gitea Container Registry
|
||||
# uses: docker/login-action@v3
|
||||
# with:
|
||||
# registry: gitea.yourdomain.com
|
||||
# username: ${{ secrets.GITEA_USERNAME }}
|
||||
# password: ${{ secrets.GITEA_PASSWORD }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}
|
||||
# Use this for GHCR:
|
||||
# images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
|
||||
# Use this for Gitea:
|
||||
# images: gitea.yourdomain.com/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=sha,prefix={{branch}}-
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.meta.outputs.digest }}
|
||||
run: |
|
||||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Push Docker image
|
||||
run: |
|
||||
# Push with registry prefix if secrets are configured
|
||||
if [ -n "${{ secrets.DOCKER_USERNAME }}" ]; then
|
||||
docker tag karaokepedia:latest ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
docker tag karaokepedia:latest ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:main-${{ github.sha }}
|
||||
docker push ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest
|
||||
docker push ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:main-${{ github.sha }}
|
||||
echo "✅ Pushed to Docker Hub: ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}"
|
||||
else
|
||||
echo "⚠️ Docker Hub credentials not configured, skipping push"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user