Skip to content

Check if a new version has been released by upstream #63

Check if a new version has been released by upstream

Check if a new version has been released by upstream #63

Workflow file for this run

name: Check if a new version has been released by upstream
on:
schedule:
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
update-snapcraft-yaml:
runs-on: ubuntu-latest
steps:
- name: install latest binary from official PPA
id: upstream
run: |
sudo apt-get install curl
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest
upstream_version=$(speedtest --version | head -n 1 | awk '{print $4}' | cut -c -5)
echo "version=$upstream_version" >> $GITHUB_OUTPUT
- name: show upstream version
run: |
upstream_version=${{ steps.upstream.outputs.version }}
if [ -z $upstream_version ]; then
exit 1
else
echo "Upstream version is $upstream_version"
fi
- name: Checkout this repo on master
uses: actions/checkout@v4
- name: get snap current version
id: current
uses: mikefarah/yq@master
with:
cmd: yq '.version' 'snap/snapcraft.yaml'
- name: show snap current version
run: echo "Current version is ${{ steps.current.outputs.result }}"
- name: update to upstream's version number
id: update
if: steps.upstream.outputs.version != steps.current.outputs.result
uses: mikefarah/yq@master
with:
cmd: yq -i '.version = "${{ steps.upstream.outputs.version }}"' 'snap/snapcraft.yaml'
- name: Commit changes
if: steps.update.outcome == 'success'
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 "update snapcraft.yaml to version ${{ steps.upstream.outputs.version }}"
git push