Check Update and Upload Releases #6924
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: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */1 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- name: Check Update | |
run: python fetch.py | |
- name: Download Latest Stable Release | |
run: python download.py | |
- name: Get Tag | |
id: get_tag | |
run: echo "tag=$(cat last_download.txt)" >> $GITHUB_ENV | |
- 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.tag }}" >/dev/null 2>&1; then | |
echo "tag_exists=true" >> $GITHUB_ENV | |
else | |
echo "tag_exists=false" >> $GITHUB_ENV | |
fi | |
- name: Commit Files | |
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 | |
- name: Push Changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
- name: Upload Release | |
if: env.exe_exists == 'true' && env.tag_exists == 'false' | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.tag }} | |
files: '*.exe' |