All checks were successful
Docker Build and Push Demo / Build-Docker-Image (push) Successful in 33s
54 lines
2.1 KiB
YAML
54 lines
2.1 KiB
YAML
name: Docker Build and Push Demo
|
|
run-name: ${{ gitea.actor }} is building a Docker image 🐳
|
|
on: [push]
|
|
|
|
jobs:
|
|
Build-Docker-Image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
|
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
|
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
|
|
|
- name: List files in the repository
|
|
run: |
|
|
echo "📁 Repository contents:"
|
|
ls -la ${{ gitea.workspace }}
|
|
|
|
- name: Prepare registry path
|
|
id: prep
|
|
run: |
|
|
# Convert repository owner to lowercase
|
|
REPO_OWNER=$(echo "${{ gitea.repository_owner }}" | tr '[:upper:]' '[:lower:]')
|
|
echo "repo_owner=${REPO_OWNER}" >> $GITHUB_OUTPUT
|
|
echo "📝 Repository owner (lowercase): ${REPO_OWNER}"
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ gitea.server_url }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.GITEATOKEN }}
|
|
|
|
- run: echo "🔨 Building Docker image..."
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: |
|
|
git.eurekin.pl/${{ steps.prep.outputs.repo_owner }}/hello-gitea:latest
|
|
git.eurekin.pl/${{ steps.prep.outputs.repo_owner }}/hello-gitea:${{ gitea.sha }}
|
|
|
|
- run: echo "📦 Docker image has been pushed to the registry!"
|
|
- run: 'echo "🎯 You can pull it with: docker pull git.eurekin.pl/${{ steps.prep.outputs.repo_owner }}/hello-gitea:latest"'
|
|
- run: echo "🍏 This job's status is ${{ job.status }}." |