From 4a15dc926abc22534bce0200b1fda9665d6bc39f Mon Sep 17 00:00:00 2001 From: phoenix Date: Fri, 31 Oct 2025 14:37:32 -0400 Subject: [PATCH] Added workflow for tag release --- .gitea/workflows/tag_release.yaml | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .gitea/workflows/tag_release.yaml diff --git a/.gitea/workflows/tag_release.yaml b/.gitea/workflows/tag_release.yaml new file mode 100644 index 0000000..ccd2041 --- /dev/null +++ b/.gitea/workflows/tag_release.yaml @@ -0,0 +1,54 @@ +name: Go Release + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build-and-release: + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.25.3' + + - name: Create version + id: create-version + run: | + VERSION=$(git tag --sort=-version:refname | sed 's/-\(main\|devel\).*//' | uniq | head -n 1) + PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10) + BRANCH_REF="${{ gitea.ref }}" + BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3) + PROJECT_TAG_RELEASE="v$VERSION-$BRANCH_NAME-$PROJECT_COMMIT_HASH-556" + + echo "::set-output name=project_tag_release::$PROJECT_TAG_RELEASE" + + echo "Version: $VERSION" + echo "Hash: $PROJECT_COMMIT_HASH" + echo "Branh ref: $BRANCH_REF" + echo "Branch: $BRANCH_NAME" + echo "Tag Release: $PROJECT_TAG_RELEASE" + + - name: Print version + id: Version + run: | + echo "Printing version" + echo "Version: ${{ steps.version.outputs.project_tag_release }}" + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.version.outputs.project_tag_release }} + release_name: Release ${{ steps.version.outputs.project_tag_release }} + body: | + Release of version ${{ steps.version.outputs.project_tag_release }}