diff --git a/.gitea/workflows/tag_release.yaml b/.gitea/workflows/tag_release.yaml new file mode 100644 index 0000000..6301e4b --- /dev/null +++ b/.gitea/workflows/tag_release.yaml @@ -0,0 +1,56 @@ +name: Release Tagging + +on: + push: + branches: + - main + - dev + tags: + - 'v*' # Trigger on tags matching v* + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Important for git describe --tags + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: cargo + + - name: Extract Version from Cargo.toml + id: version + run: | + VERSION=$(grep '^version = "' Cargo.toml | sed -E 's/version = "([^"]+)"/\1/') + PROJECT_COMMIT_HASH=$(git rev-parse HEAD | cut -c 1-10) + BRANCH_REF="${GITHUB_REF}" + BRANCH_NAME=$(echo "$BRANCH_REF" | cut -d '/' -f 3) + PROJECT_TAG_RELEASE="v$VERSION-$BRANCH_NAME-$PROJECT_COMMIT_HASH" + echo "::set-output name=project_tag_release::$PROJECT_TAG_RELEASE-111" + echo "Version: $VERSION" + echo "Hash: $PROJECT_COMMIT_HASH" + echo "Branch: $BRANCH_NAME" + echo "Tag Release: $PROJECT_TAG_RELEASE" + + - name: Print version + id: Version + run: | + echo "Printing version" + echo "Version: ${{ steps.setvar.outputs.project_tag_release }}" + # - name: Create GitHub Release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ steps.setvar.outputs.project_tag_release }} + # release_name: Release ${{ steps.setvar.outputs.project_tag_release }} + # body: | + # Release of version ${{ steps.setvar.outputs.project_tag_release }} + # draft: false + # prerelease: ${{ startsWith(github.ref, 'v') == false }} # prerelease if not a valid release tag +