Skip to content

Commit 19afe13

Browse files
authored
V 1.0.0
1 parent a3c50c1 commit 19afe13

1 file changed

Lines changed: 24 additions & 9 deletions

File tree

.github/workflows/blank.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
1818

19+
- name: Get commit message
20+
id: commit_message
21+
run: echo "MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
22+
23+
- name: Check if commit message is a version tag
24+
id: check_version
25+
run: |
26+
if [[ "${{ env.MESSAGE }}" =~ ^V\ [0-9]+\.[0-9]+\.[0-9]+$ ]]; then
27+
VERSION=$(echo "${{ env.MESSAGE }}" | awk '{print $2}')
28+
echo "VERSION=$VERSION" >> $GITHUB_ENV
29+
echo "MATCH=1" >> $GITHUB_ENV
30+
else
31+
echo "MATCH=0" >> $GITHUB_ENV
32+
fi
33+
34+
- name: Stop if no valid version tag
35+
if: env.MATCH != '1'
36+
run: echo "Commit message does not contain a valid version tag. Skipping release." && exit 0
37+
1938
- name: Install dependencies
2039
run: sudo apt update && sudo apt install -y build-essential libssl-dev libboost-all-dev
2140

@@ -28,23 +47,19 @@ jobs:
2847
mv JC-sdhash SDhash
2948
ls -lah
3049
31-
- name: Generate Tag
32-
id: tag
33-
run: echo "TAG_NAME=auto-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
34-
35-
- name: Create Tag
50+
- name: Create Git Tag
3651
run: |
3752
git config user.name "GitHub Actions"
3853
git config user.email "actions@github.com"
39-
git tag ${{ steps.tag.outputs.TAG_NAME }}
40-
git push origin ${{ steps.tag.outputs.TAG_NAME }}
54+
git tag ${{ env.VERSION }}
55+
git push origin ${{ env.VERSION }}
4156
4257
- name: Create GitHub Release
4358
uses: softprops/action-gh-release@v2
4459
with:
4560
files: ./SDhash
46-
tag_name: ${{ steps.tag.outputs.TAG_NAME }}
47-
name: "Release ${{ steps.tag.outputs.TAG_NAME }}"
61+
tag_name: ${{ env.VERSION }}
62+
name: "Release ${{ env.VERSION }}"
4863
body: "Automated release for commit ${{ github.sha }}"
4964
env:
5065
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)