-
Notifications
You must be signed in to change notification settings - Fork 26
62 lines (53 loc) · 1.86 KB
/
release.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
55
56
57
58
59
60
61
62
name: Auto Release
on:
workflow_run:
workflows:
- Builds
types:
- completed
jobs:
release:
runs-on: ubuntu-latest
if: >
github.ref == 'refs/heads/main' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.conclusion == 'success' &&
github.repository == 'ittuann/Awesome-IntelligentCarRace'
steps:
- name: Checking Out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for data changes
id: check_changes
run: |
if [[ "$(git rev-list --count HEAD)" -gt 1 ]]; then
if git diff --name-only HEAD^ HEAD | grep -q "table.csv"; then
echo "DATA_FILE_CHANGED=true" >> $GITHUB_ENV
else
echo "Date file has not changed in the last commit."
fi
DATA_FILE_SHA256=$(sha256sum table.csv | awk '{print $1}')
echo "DATA_FILE_SHA256=$DATA_FILE_SHA256" >> $GITHUB_ENV
echo "Data file SHA: $DATA_FILE_SHA256"
echo "COMMIT_TIME=$(git log -1 --format=%cd --date=format:%Y%m%dT%H%M%S)" >> $GITHUB_ENV
fi
- name: Upload new date artifact
if: env.DATA_FILE_CHANGED == 'true'
uses: actions/upload-artifact@v4
with:
name: date.csv
path: table.csv
- name: Auto create new date release
if: env.DATA_FILE_CHANGED == 'true'
uses: softprops/action-gh-release@v2
with:
files: table.csv
tag_name: ${{ env.COMMIT_TIME }}
name: Auto Release ${{ env.COMMIT_TIME }}
body: |
Automatically release the data table in `${{ env.COMMIT_TIME }}`, UTC+08:00, Time Zone: Asia/Shanghai
Commit SHA: ${{ github.sha }}
File SHA256: `${{ env.DATA_FILE_SHA256 }}`
draft: false
prerelease: false