60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
name: Daily Update Pipeline
|
|
|
|
on:
|
|
schedule:
|
|
# Runs every day at 3:00 AM UTC
|
|
- cron: '0 3 * * *'
|
|
workflow_dispatch: # Allows manual triggering
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
config-inline: |
|
|
[registry."10.0.0.2:3000"]
|
|
http = true
|
|
insecure = true
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
run: |
|
|
# Configure Docker to allow insecure registry for this session
|
|
mkdir -p ~/.docker
|
|
echo '{
|
|
"auths": {},
|
|
"insecure-registries": ["10.0.0.2:3000"]
|
|
}' > ~/.docker/config.json
|
|
|
|
# Login using direct docker command
|
|
echo "${{ secrets.CI_RUNNER_TOKEN }}" | docker login 10.0.0.2:3000 --username "${{ gitea.actor }}" --password-stdin
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: 10.0.0.2:3000/${{ gitea.repository_owner }}/${{ gitea.event.repository.name }}
|
|
tags: |
|
|
type=schedule,pattern={{date 'YYYYMMDD'}}
|
|
type=raw,value=latest,enable={{is_default_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: Update deployment info
|
|
run: |
|
|
echo "Docker image built and pushed successfully at $(date)"
|
|
echo "Image tags: ${{ steps.meta.outputs.tags }}"
|