ci: add automated docker build and deployment
All checks were successful
Build and Deploy / build-and-push (push) Successful in 42s

This commit is contained in:
2026-04-28 15:21:44 +02:00
parent 1f528f79a6
commit fbfe5d8be1

View File

@@ -0,0 +1,51 @@
name: "Build and Deploy"
on:
push:
branches:
- main
- master
paths-ignore:
- .gitignore
- README.md
- LICENSE
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allow one concurrent deployment
concurrency:
group: "webpage"
cancel-in-progress: true
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# submodules: true
# If using the 'assets' git submodule from Chirpy Starter, uncomment above
# (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets)
- name: Login to Gitea Container Registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${CI_REGISTRY:-git.pixx.cz} \
-u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
- name: Build Docker image
run: |
echo "FROM nginx:alpine" > Dockerfile
echo "COPY . /usr/share/nginx/html" >> Dockerfile
docker build -t ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:${{ gitea.sha }} .
- name: Push Docker image
run: |
docker tag ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:${{ gitea.sha }} \
${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:latest
docker push ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:${{ gitea.sha }}
docker push ${CI_REGISTRY_IMAGE:-git.pixx.cz/${{ gitea.repository }}}:latest