Skip to content

Commit

Permalink
Add auto release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ittuann committed Dec 10, 2023
1 parent 966efe0 commit 08ede06
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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_SHA=$(sha256sum table.csv | awk '{print $1}')
echo "DATA_FILE_SHA=$DATA_FILE_SHA" >> $GITHUB_ENV
echo "Data file SHA: $DATA_FILE_SHA"
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@v3
with:
name: date.csv
path: table.csv

- name: Auto create new date release
if: env.DATA_FILE_CHANGED == 'true'
uses: softprops/action-gh-release@v1
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 SHA: `${{ env.DATA_FILE_SHA }}`
draft: false
prerelease: false
1 change: 1 addition & 0 deletions table.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ DZXS-天眼,https://github.com/JinHeMu/smart-car,大连交通大学,智能视觉
昌平队,https://github.com/ittuann/Awesome-IntelligentCarRace/issues/9,合肥学院,负压电磁组,省1,2023,
地灵殿的装修队,https://github.com/FredBill1/RT1064_Smartcar,中国矿业大学(北京),智能视觉组,国2,2022,
顽强土拨鼠,https://www.bilibili.com/video/BV1vY411y7KX,攀枝花学院,智能视觉组,国1,2022,

0 comments on commit 08ede06

Please sign in to comment.