From 0c42d1722c6e493adc63e8d5dcc0a9714d5cb734 Mon Sep 17 00:00:00 2001 From: Isaac Date: Mon, 13 Apr 2026 14:35:00 +0300 Subject: [PATCH] add ci pipeline --- .gitea/workflows/ci.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .gitea/workflows/ci.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..873cd8c --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,35 @@ +name: Build and Push to Registry +on: [push] + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Log in to Custom Registry + run: | + echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ secrets.REGISTRY_URL }} -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin + + - name: Set up Docker Tags + id: vars + run: | + # Use the short git commit hash as a tag + echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + # Define the full image name + echo "image_path=${{ secrets.REGISTRY_URL }}/servernah/devops-website" >> $GITHUB_OUTPUT + + - name: Build Docker Image + run: | + docker build -t ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }} . + docker tag ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.image_path }}:latest + + - name: Push Image to Registry + run: | + docker push ${{ steps.vars.outputs.image_path }}:${{ steps.vars.outputs.sha_short }} + docker push ${{ steps.vars.outputs.image_path }}:latest + + - name: Cleanup + if: always() + run: docker logout ${{ secrets.REGISTRY_URL }} \ No newline at end of file