From 046831b905559ed5973349b2f4ba6b4293442c28 Mon Sep 17 00:00:00 2001 From: rebecca Date: Tue, 4 Nov 2025 11:58:10 -0300 Subject: [PATCH] devops: trigger build-and-push on release publish; extract release tag; pass it to build-and-push.sh; add docker to the dockerfile for cli availability. --- .gitea/workflows/build-and-push.yaml | 29 ++++++++++++++++------------ Dockerfile | 2 +- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml index ce03de9..34b7e7f 100644 --- a/.gitea/workflows/build-and-push.yaml +++ b/.gitea/workflows/build-and-push.yaml @@ -1,13 +1,8 @@ name: build-and-upload-docker on: - push: - branches: - - trunk - paths: - - 'Dockerfile' - - 'rootfs/**' - - 'build.sh' + release: + types: [published] jobs: build-and-upload: @@ -15,17 +10,27 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - + + - name: Parse release version + id: get_version + run: | + # Remove 'refs/tags/' if present, fallback to GITHUB_REF_NAME if possible + ref="${GITHUB_REF#refs/tags/}" + if [ -z "$ref" ]; then + ref="${GITHUB_REF_NAME:-}" + fi + echo "release_tag=$ref" >> "$GITHUB_OUTPUT" + - name: Build and push run: | - chmod +x ./build.sh - ./build.sh \ No newline at end of file + chmod +x ./build-and-push.sh + ./build-and-push.sh "${{ steps.get_version.outputs.release_tag }}" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b30644f..fd99c6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,2 @@ FROM gitea/act_runner:latest -RUN apk add --no-cache nodejs npm \ No newline at end of file +RUN apk add --no-cache nodejs npm docker \ No newline at end of file