-
Notifications
You must be signed in to change notification settings - Fork 404
54 lines (46 loc) · 1.48 KB
/
version.yml
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 🔖 Version
on:
push:
branches:
- main
- dev
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
version:
name: 🚀 Update Version
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: 🔢 Get HEAD commit hash
id: get_head_hash
run: echo "HEAD_HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: 📅 Get current date
id: get_date
run:
echo "CURRENT_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: 📝 Update package.json
run: |
jq '
if .["epic-stack"] then
.["epic-stack"].head = "${{ steps.get_head_hash.outputs.HEAD_HASH }}" |
.["epic-stack"].date = "${{ steps.get_date.outputs.CURRENT_DATE }}"
else
.["epic-stack"] = {
"head": "${{ steps.get_head_hash.outputs.HEAD_HASH }}",
"date": "${{ steps.get_date.outputs.CURRENT_DATE }}"
}
end
' package.json > temp.json && mv temp.json package.json
- name: 💾 Commit changes
run: |
git config --local user.email "kody@epicweb.dev"
git config --local user.name "kody"
git add package.json
git commit -m "Update epic-stack version [skip ci]"
git push