From 09047ee28622e80728b718175de1b72460ad8317 Mon Sep 17 00:00:00 2001 From: Jagrit Thapar Date: Sat, 7 Sep 2024 09:23:43 +0530 Subject: [PATCH] Add: Gitea Actions workflow file --- .gitea/workflows/build.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..16e7771 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,36 @@ +name: Build and Push Docker Image +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest # I have self-hosted actions runner :D + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Container Registry to push the artifact after build + run: echo "${{ secrets.CR_passkey }}" | docker login ${{ secrets.CR_endpoint }} -u ${{ secrets.CR_username }} --password-stdin + + - name: Generate tag for the image + run: | + SHA_TAG=${CI_COMMIT_SHA::5} + REPO_NAME=$(basename $CI_REPOSITORY) + IMAGE_TAG_SHA="${{ secrets.CR_endpoint }}/${{ secrets.CR_username }}/${REPO_NAME}:${SHA_TAG}" +# IMAGE_TAG_LATEST="${{ secrets.CR_endpoint }}/${{ secrets.CR_username }}/${REPO_NAME}:latest" + + + - name: Build container image + run: docker build -t $IMAGE_TAG_SHA . # -t $IMAGE_TAG_LATEST . + + - name: Push Docker image to Container Registry + run: | + docker push $IMAGE_TAG_SHA + +