Check Update and Upload Releases #8451
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Update and Upload Releases | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */1 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check Update | |
run: python fetch.py | |
- name: Download Latest Stable Releases | |
run: python download.py | |
- name: Check for EXE Files | |
id: check_files | |
run: | | |
if find . -name "*.exe" -print -quit | grep -q .; then | |
echo "exe_exists=true" >> $GITHUB_ENV | |
else | |
echo "exe_exists=false" >> $GITHUB_ENV | |
fi | |
- name: Check if Tag Exists | |
id: check_tag | |
run: | | |
if git rev-parse "refs/tags/${{ env.latest_version }}" >/dev/null 2>&1; then | |
echo "tag_exists=true" >> $GITHUB_ENV | |
else | |
echo "tag_exists=false" >> $GITHUB_ENV | |
fi | |
- name: Commit and Push Changes | |
env: | |
TZ: America/New_York | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m ":pencil: Auto update Edge at $(date +"%Y-%m-%d %H:%M")" -a || echo "No changes to commit" | |
git push origin main | |
- name: Upload Release | |
if: env.exe_exists == 'true' && env.tag_exists == 'false' | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.latest_version }} | |
files: '*.exe' | |
- name: Reset Main Branch | |
if: env.exe_exists == 'true' && env.tag_exists == 'false' | |
run: | | |
git checkout --orphan temp_branch | |
git add -A | |
git commit -m "Init" | |
git push --force origin temp_branch:main |