From 196be63418fc7dd79f5de7f2f6a0ccd45ca7abd3 Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 13:11:22 +0100 Subject: [PATCH 1/2] ci: store release version in environment variable --- .gitea/workflows/release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 3d002f7..de1fde9 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -59,12 +59,13 @@ jobs: run: echo ${{ github.sha }} > Release.txt - name: Tag Release Commit run: | - echo ${{github.event.head_commit.message}} | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+' > Version.txt - echo "==> Tagging for version: $(cat Version.txt)" + export VERSION=$(echo ${{github.event.head_commit.message}} | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+') + echo "==> Tagging for version: ${VERSION}" git config --global credential.helper store echo "https://${USERNAME}:${{secrets.RELEASE_TOKEN}}}@${{github.repositoryUrl}}" > ~/.git-credentials - git tag -m "Release" "$(cat Version.txt)" - git push ${{github.repositoryUrl}} "$(cat Version.txt)" + git tag -m "Release" "${VERSION}" + git push origin "${VERSION}" + echo "${VERSION}" > Version.txt - name: Create release id: create-release uses: https://gitea.com/actions/release-action@main -- 2.40.1 From 22e58eec815770be595831f93162de616c49da4c Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 25 Nov 2024 13:15:10 +0100 Subject: [PATCH 2/2] ci: store commit message in intermediate environment variable --- .gitea/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index de1fde9..df4a2ed 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -58,8 +58,10 @@ jobs: - name: Prepare Release run: echo ${{ github.sha }} > Release.txt - name: Tag Release Commit + env: + COMMIT_MESSAGE: ${{github.event.head_commit.message}} run: | - export VERSION=$(echo ${{github.event.head_commit.message}} | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+') + export VERSION=$(echo "${COMMIT_MESSAGE}" | grep -Po '(?<=Release-As: )v\d+\.\d+\.\d+') echo "==> Tagging for version: ${VERSION}" git config --global credential.helper store echo "https://${USERNAME}:${{secrets.RELEASE_TOKEN}}}@${{github.repositoryUrl}}" > ~/.git-credentials -- 2.40.1