Fetch Latest Version #17
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: 'Fetch Latest Version' | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
permissions: write-all | |
jobs: | |
fetch-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@main | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
make install_dependencies | |
- name: Fetch APT repository | |
run: | | |
curl -fSsL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor | sudo tee /usr/share/keyrings/google-chrome.gpg >> /dev/null | |
echo deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main | sudo tee /etc/apt/sources.list.d/google-chrome.list | |
sudo apt-get update | |
LATEST_VERSION="$(apt-cache policy google-chrome-stable | grep Candidate | awk '{print $2}')" | |
echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV | |
- name: Update matrix file | |
run: | | |
python3 scripts/update_latest.py ${LATEST_VERSION} | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Happy TestOps Robot" | |
git commit -m "[ci] Update version ${LATEST_VERSION}" -m "[skip test]" -a || true | |
git pull --rebase | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.ORG_CI_TOKEN }} | |
- name: Check if version was archived already | |
uses: insightsengineering/release-existence-action@main | |
id: check_release | |
with: | |
release-tag: ${{ env.LATEST_VERSION }} | |
- name: Download deb package | |
if: steps.check_release.outputs.release-exists == 'false' | |
run: | | |
apt download google-chrome-stable | |
ls -l google-chrome-stable_*.deb | |
- name: Archive build as GH release | |
if: steps.check_release.outputs.release-exists == 'false' | |
uses: softprops/action-gh-release@master | |
with: | |
files: | | |
google-chrome-stable_*.deb | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag_name: ${{ env.LATEST_VERSION }} | |
name: ${{ env.LATEST_VERSION }} | |
body: ${{ env.LATEST_VERSION }} | |
draft: false | |
prerelease: false |