From 44cf5b660708645ffeec78882274b8af0ca69797 Mon Sep 17 00:00:00 2001 From: Mads Smed Date: Sun, 23 Nov 2025 16:27:58 +0100 Subject: [PATCH] test --- .gitea/workflows/ci.yaml | 60 ++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index c537cc6..ee0b91f 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -1,19 +1,51 @@ -name: Gitea Actions Demo -run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 -on: [push] +name: Build & Push Docker Image +run-name: "Build & publish go-micro-service Docker image" + +on: + push: + branches: + - main jobs: - Explore-Gitea-Actions: - runs-on: ubuntu-latest + build-and-push: + runs-on: ubuntu-latest # ← must match your Gitea Act Runner label + 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 + # ---------------------------------------------------------- + # 1. Check out code + # ---------------------------------------------------------- + - name: Checkout repository uses: actions/checkout@v4 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository + + # ---------------------------------------------------------- + # 2. Set required variables + # ---------------------------------------------------------- + - name: Set environment variables run: | - ls ${{ gitea.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." + echo "REGISTRY=${{ gitea.server_url }}" >> $GITHUB_ENV + echo "IMAGE_NAME=${{ gitea.repository }}" >> $GITHUB_ENV + echo "TAG=latest" >> $GITHUB_ENV + + # ---------------------------------------------------------- + # 3. Login to Gitea Container Registry + # You must create a secret: GITEA_REGISTRY_TOKEN + # ---------------------------------------------------------- + - name: Log in to Gitea Container Registry + run: | + echo "${{ secrets.GITEA_REGISTRY_TOKEN }}" | \ + docker login ${{ env.REGISTRY }} \ + -u "${{ gitea.actor }}" --password-stdin + + # ---------------------------------------------------------- + # 4. Build Docker image from your Dockerfile + # ---------------------------------------------------------- + - name: Build Docker image + run: | + docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} . + + # ---------------------------------------------------------- + # 5. Push Docker image + # ---------------------------------------------------------- + - name: Push Docker image + run: | + docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}