- Add .gitea/workflows/docker.yml: builds and pushes Docker image on Git tags with semantic versioning (v0.1.0 → tags 0.1.0, 0.1, latest) - Add .dockerignore to optimize Docker build context - Document release process in docs/DEVELOPMENT.md - Update CHANGELOG.md with v0.1.0 release and Unreleased CI/CD entry Required Gitea secrets: REGISTRY_USERNAME, REGISTRY_PASSWORD Co-authored-by: Junie <junie@jetbrains.com>
51 lines
1.5 KiB
YAML
51 lines
1.5 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 'v' prefix from tag (e.g., v0.1.0 → 0.1.0)
|
|
VERSION=$(echo "${{ gitea.ref }}" | sed 's|refs/tags/v||')
|
|
echo "version=${VERSION}" >> "${GITEA_OUTPUT}"
|
|
|
|
# Extract major.minor for minor tag (e.g., 0.1.0 → 0.1)
|
|
MINOR=$(echo "${VERSION}" | sed 's/\.[0-9]*$//')
|
|
echo "minor=${MINOR}" >> "${GITEA_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
|