From 75475ce4ce0d773b06ed779bc9e144bf2db462db Mon Sep 17 00:00:00 2001 From: Michael Reber Date: Sun, 30 Nov 2025 13:54:50 +0100 Subject: [PATCH] add CI/CD pipeline for automatically build the container --- .gitea/workflows/build-harbor.yml | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .gitea/workflows/build-harbor.yml diff --git a/.gitea/workflows/build-harbor.yml b/.gitea/workflows/build-harbor.yml new file mode 100644 index 0000000..cf713b8 --- /dev/null +++ b/.gitea/workflows/build-harbor.yml @@ -0,0 +1,39 @@ +name: Build and Push to Harbor when new commit to main-branch + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + runs-on: linux_amd64 + steps: + - uses: actions/checkout@v4 + + - name: Login to Harbor (Robot) + if: ${{ secrets.HARBOR_REGISTRY && secrets.HARBOR_USERNAME && secrets.HARBOR_PASSWORD }} + env: + REGISTRY: ${{ secrets.HARBOR_REGISTRY }} + ROBOT_USER: ${{ secrets.HARBOR_USERNAME }} + ROBOT_PASS: ${{ secrets.HARBOR_PASSWORD }} + run: | + mkdir -p "$HOME/.config/containers" + echo "$ROBOT_PASS" | podman login --username "$ROBOT_USER" --password-stdin "$REGISTRY" + + + - name: Build & tag + env: + REG: ${{ secrets.HARBOR_REGISTRY }} + PROJ: ${{ secrets.HARBOR_PROJECT }} + run: | + podman build -t $REG/$PROJ/swiss-datashare:${{ github.sha }} . + podman tag $REG/$PROJ/swiss-datashare:${{ github.sha }} $REG/$PROJ/swiss-datashare:latest + + - name: Push + env: + REG: ${{ secrets.HARBOR_REGISTRY }} + PROJ: ${{ secrets.HARBOR_PROJECT }} + run: | + podman push $REG/$PROJ/swiss-datashare:${{ github.sha }} + podman push $REG/$PROJ/swiss-datashare:latest