Check DL URL #102
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 DL URL | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Download webpage | |
run: curl -o webpage.html -L https://developer.android.com/studio/run/win-usb | |
- name: Extract download URL | |
run: | | |
dlurl=$(grep -o -m 1 'https://dl.google.com/[^"]*' webpage.html) | |
currentdate=$(date -u +"%a-%b-%e-%T-UTC-%Y") | |
encodeddate=$(echo "$currentdate" | sed 's/ /-/g' | sed 's/:/-/g') | |
modifiedurl="${dlurl}?lastUpdated=${encodeddate}" | |
echo "$modifiedurl" > urls/driverurl.txt | |
- name: Update Driver URL | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git add urls/driverurl.txt | |
git commit -m "Auto Update Driver URL" | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |