-
Notifications
You must be signed in to change notification settings - Fork 18
47 lines (44 loc) · 1.94 KB
/
bump-beta-rust-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Copyright (C) 2022 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
name: Check for new rust requirement on the beta branch
on:
schedule:
# run daily (at 5:17 UTC)
- cron: '17 5 * * *'
workflow_dispatch:
jobs:
check-new-rust-requirement-beta:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: beta
persist-credentials: false
- name: Install script dependencies
run: sudo apt update && sudo apt install coreutils curl dpkg grep
- name: Update rust requirement if needed
run: |
CURRENT=$(grep -m1 REQUIRED_RUST_VERSION snapcraft.yaml | cut -d= -f2)
echo "Current rust version requirement: $CURRENT"
FILE=https://hg.mozilla.org/releases/mozilla-beta/raw-file/tip/python/mozboot/mozboot/util.py
NEW=$(curl -s $FILE | grep MINIMUM_RUST_VERSION | cut -d= -f2 | cut -d\" -f2)
echo "New rust version requirement: $NEW"
if $(dpkg --compare-versions $CURRENT lt $NEW); then
sed -i "s/\(REQUIRED_RUST_VERSION=\)$CURRENT/\1$NEW/" snapcraft.yaml
git add snapcraft.yaml
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git commit -m "Bump rust requirement ($NEW)."
git push https://${{ github.actor }}:${{ secrets.REPO_TOKEN }}@github.com/${{ github.repository }}.git beta
fi