From 395b328c58f3b8fae22c9adbd62795eaadfa7537 Mon Sep 17 00:00:00 2001 From: Gusram Date: Thu, 15 Aug 2024 21:30:09 +0800 Subject: [PATCH] add build workflows --- .gitea/workflows/build.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 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..c9c9589 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,28 @@ +name: Main CI/CD + +on: + push: + branches: + - main + +jobs: + build-and-push: + name: Build and push + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: docker/login-action@v1 + with: + registry: registry.btwazure.com + username: ${{ secrets.HARBOR_USERNAME }} + password: ${{ secrets.HARBOR_PASSWORD }} + - name: Build & Push + env: + REGISTRY: ${{ secrets.REGISTRY }} + IMAGE_TAG: ${{gitea.sha}} + run: | + docker build --pull --no-cache=true --tag $REGISTRY --tag $REGISTRY:$IMAGE_TAG . + docker push $REGISTRY + docker push $REGISTRY:$IMAGE_TAG + docker rmi $(docker images -q $REGISTRY:$IMAGE_TAG) -f \ No newline at end of file