Skip to content

Fetch Latest Version #287

Fetch Latest Version

Fetch Latest Version #287

Workflow file for this run

name: 'Fetch Latest Version'
on:
workflow_dispatch:
inputs:
update-existing-release:
description: 'Force update an existing release'
required: false
default: 'false'
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' ||
github.event.inputs.update-existing-release == 'true'
run: |
apt download google-chrome-stable
ls -l google-chrome-stable_*.deb
- name: Get metadata from DEB package
if: steps.check_release.outputs.release-exists == 'false' ||
github.event.inputs.update-existing-release == 'true'
id: get_metadata
run: |
DEB_FILE=$(ls google-chrome-stable_*.deb)
dpkg-deb -I $DEB_FILE > metadata.txt
dpkg-deb -c $DEB_FILE > contents.txt
sha256sum $DEB_FILE > checksums.sha256
- name: Test deb package installation
if: steps.check_release.outputs.release-exists == 'false' ||
github.event.inputs.update-existing-release == 'true'
run: |
DEB_FILE=$(ls google-chrome-stable_*.deb)
sudo apt-get -qqy --no-install-recommends install --allow-downgrades ./$DEB_FILE
google-chrome --version
- name: Archive build as GH release
if: steps.check_release.outputs.release-exists == 'false' ||
github.event.inputs.update-existing-release == 'true'
uses: softprops/action-gh-release@master
with:
files: |
google-chrome-stable_*.deb
metadata.txt
contents.txt
checksums.sha256
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.LATEST_VERSION }}
name: ${{ env.LATEST_VERSION }}
body: ${{ env.LATEST_VERSION }}
draft: false
prerelease: false