-
Notifications
You must be signed in to change notification settings - Fork 1
28 lines (24 loc) · 870 Bytes
/
Copy pathupdate_version.yml
File metadata and controls
28 lines (24 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
name: Update VERSION.txt
on: [push]
jobs:
version:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
- name: Generate version
run: |
echo "v$(TZ=America/New_York date +'%Y.%m.%d-%H%M%z')-g$(git rev-parse --short HEAD)" > VERSION.txt
- name: Conditionally commit and push version file
run: |
if [[ "${{ github.event.head_commit.message }}" == *"Update VERSION.txt"* ]]; then
echo "VERSION.txt already updated — skipping push to avoid loop."
else
git config user.name "github-actions"
git config user.email "actions@github.com"
git add VERSION.txt
git commit -m "Update VERSION.txt" || echo "No changes to commit"
git push
fi