-
Notifications
You must be signed in to change notification settings - Fork 346
35 lines (30 loc) · 964 Bytes
/
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
name: Write project version
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout codes'
uses: actions/checkout@v2
- name: 'Generate version'
run: |
updated=$(date "+%Y-%m-%dT%H:%M:%SZ" -d "+8 hour")
echo -n "$updated" | md5sum | tr a-z A-Z | cut -d ' ' -f1 > utils/version
- name: 'Commit file'
id: commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git diff --quiet && git diff --staged --quiet || git commit -am 'Automatically write version information'
echo ::set-output name=status::success
- name: 'GitHub push'
if: steps.commit.output.status != 'success'
uses: ad-m/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
branch: ${{ github.ref }}