Use tag of git repo instead of branch #649

Open
opened 2025-10-31 15:17:07 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @krom on GitHub (Oct 29, 2025).

My current implementation with forgejo runner

  1. I push new code to the main branch
  2. I create tag e.g. v2.4.1
  3. Action runs only for tags started with v
  4. Action extract version from tag
  5. Action buids docker image
  6. Action pushes docker image with specific tags (latest and 2.4.1)

What I want

  1. Allow to provide specific tag like this
    Image

2.Allow to extract version from tag
Image

  1. Update tag from webhook's data

Forgego action for reference

name: Build and Push Docker Image

on:
  push:
    tags:
      - 'v*'

jobs:
  docker-release:
    runs-on: docker
    container:
      image: "ghcr.io/catthehacker/ubuntu:act-24.04"
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Extract the correct tag
        id: extract_tag
        run: echo "::set-output name=tag::$(echo ${{ env.GITHUB_REF_NAME }} | grep -oP '(?<=v)[^/]+')"

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: git.domain.com/docker/openbao-softhsm
          tags: |
            type=raw,value=latest
            type=raw,value=${{ steps.extract_tag.outputs.tag }}

      - name: Login to Container Registry
        uses: docker/login-action@v3
        with:
          registry: git.domain.com
          username: ${{ secrets.FORGEJO_REGISTRY_USER }}
          password: ${{ secrets.FORGEJO_REGISTRY_TOKEN }}

      - name: Setup Docker Buildx
        uses: docker/setup-buildx-action@v1

      - name: Build and Push
        uses: docker/build-push-action@v6
        with:
          push: true
          tags: ${{ steps.meta.outputs.tags }}
Originally created by @krom on GitHub (Oct 29, 2025). **My current implementation with forgejo runner** 1. I push new code to the main branch 2. I create tag e.g. v2.4.1 3. Action runs only for tags started with `v` 4. Action extract version from tag 5. Action buids docker image 6. Action pushes docker image with specific tags (latest and 2.4.1) **What I want** 1. Allow to provide specific tag like this <img width="713" height="608" alt="Image" src="https://github.com/user-attachments/assets/c05f57c3-d989-4cdf-8840-c0933bf77532" /> 2.Allow to extract version from tag <img width="736" height="466" alt="Image" src="https://github.com/user-attachments/assets/5a5dbb23-a281-42f7-b366-8ff354d550a4" /> 3. Update tag from webhook's data **Forgego action for reference** ```yaml name: Build and Push Docker Image on: push: tags: - 'v*' jobs: docker-release: runs-on: docker container: image: "ghcr.io/catthehacker/ubuntu:act-24.04" steps: - name: Checkout uses: actions/checkout@v4 - name: Extract the correct tag id: extract_tag run: echo "::set-output name=tag::$(echo ${{ env.GITHUB_REF_NAME }} | grep -oP '(?<=v)[^/]+')" - name: Docker meta id: meta uses: docker/metadata-action@v5 with: images: git.domain.com/docker/openbao-softhsm tags: | type=raw,value=latest type=raw,value=${{ steps.extract_tag.outputs.tag }} - name: Login to Container Registry uses: docker/login-action@v3 with: registry: git.domain.com username: ${{ secrets.FORGEJO_REGISTRY_USER }} password: ${{ secrets.FORGEJO_REGISTRY_TOKEN }} - name: Setup Docker Buildx uses: docker/setup-buildx-action@v1 - name: Build and Push uses: docker/build-push-action@v6 with: push: true tags: ${{ steps.meta.outputs.tags }} ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#649
No description provided.