From fbfe5d8be176bd3c4e02dfae72d7c806654496f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Z=C3=A1le=C5=A1=C3=A1k?= Date: Tue, 28 Apr 2026 15:21:44 +0200 Subject: [PATCH] ci: add automated docker build and deployment --- .gitea/workflows/deploy.yml | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..98eb84e --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -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 +