diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 7db77e0..e54a936 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -160,16 +160,6 @@ jobs: with: fetch-depth: 0 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Gitea Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ gitea.server_url }} - username: ${{ gitea.actor }} - password: ${{ secrets.GITEA_TOKEN }} - - name: Extract version metadata id: meta run: | @@ -182,21 +172,37 @@ jobs: echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "registry=$REGISTRY" >> "$GITHUB_OUTPUT" - # Build tag list: version + latest (only for stable releases) - TAGS="$REGISTRY:$TAG,$REGISTRY:$VERSION" - if ! echo "$TAG" | grep -qE '(alpha|beta|rc)'; then - TAGS="$TAGS,$REGISTRY:latest" - fi - echo "tags=$TAGS" >> "$GITHUB_OUTPUT" + - name: Login to Gitea Container Registry + run: | + echo "${{ secrets.GITEA_TOKEN }}" | docker login \ + "$(echo '${{ gitea.server_url }}' | sed 's|https\?://||')" \ + -u "${{ gitea.actor }}" --password-stdin - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: ./server - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: | - org.opencontainers.image.version=${{ steps.meta.outputs.version }} - org.opencontainers.image.revision=${{ gitea.sha }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build Docker image + run: | + TAG="${{ gitea.ref_name }}" + REGISTRY="${{ steps.meta.outputs.registry }}" + + docker build \ + --label "org.opencontainers.image.version=${{ steps.meta.outputs.version }}" \ + --label "org.opencontainers.image.revision=${{ gitea.sha }}" \ + -t "$REGISTRY:$TAG" \ + -t "$REGISTRY:${{ steps.meta.outputs.version }}" \ + ./server + + # Tag as latest only for stable releases + if ! echo "$TAG" | grep -qE '(alpha|beta|rc)'; then + docker tag "$REGISTRY:$TAG" "$REGISTRY:latest" + fi + + - name: Push Docker image + run: | + TAG="${{ gitea.ref_name }}" + REGISTRY="${{ steps.meta.outputs.registry }}" + + docker push "$REGISTRY:$TAG" + docker push "$REGISTRY:${{ steps.meta.outputs.version }}" + + if ! echo "$TAG" | grep -qE '(alpha|beta|rc)'; then + docker push "$REGISTRY:latest" + fi