Docker Build and Push / build-and-push (push) Canceled after 0s
Gitea Actions uses GITHUB_OUTPUT to set step outputs, not GITEA_OUTPUT. This was causing version and minor variables to be empty, so only the 'latest' tag was pushed to the registry. Added debug logging to help diagnose future issues. Co-authored-by: Junie <junie@jetbrains.com>
53 lines
1.6 KiB
YAML
53 lines
1.6 KiB
YAML
name: Docker Build and Push
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
env:
|
|
REGISTRY: gitea.jambotron.com
|
|
IMAGE_NAME: liosha84/htop-web
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: |
|
|
# Remove 'refs/tags/v' prefix from tag (e.g., refs/tags/v0.1.0 → 0.1.0)
|
|
VERSION=$(echo "${{ gitea.ref }}" | sed 's|refs/tags/v||')
|
|
echo "Extracted version: ${VERSION}"
|
|
echo "version=${VERSION}" >> "${GITHUB_OUTPUT}"
|
|
|
|
# Extract major.minor for minor tag (e.g., 0.1.0 → 0.1)
|
|
MINOR=$(echo "${VERSION}" | sed 's/\.[0-9]*$//')
|
|
echo "Extracted minor: ${MINOR}"
|
|
echo "minor=${MINOR}" >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.minor }}
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|