forked from canonical/firefox-snap
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (118 loc) · 4.91 KB
/
new-version-check.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Copyright (C) 2021 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: New version check
on:
schedule:
# run every hour (at minute 58)
- cron: '58 * * * *'
workflow_dispatch:
jobs:
check-new-stable:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: stable
- name: Extract current version
run: ./.github/scripts/extract-current-version.sh
- name: Install python deps
run: sudo apt update && sudo apt install python3-lxml python3-packaging
- name: Fetch new version
run: |
version=$(./.github/scripts/check-new-version.py release ${{ env.current_version }})
echo "new_version=$version" >> $GITHUB_ENV
- name: Update snapcraft.yaml with the new version
if: env.new_version
run: |
if [ $(echo ${{ env.current_version }} | cut -d. -f1) = $(echo ${{ env.new_version }} | cut -d. -f1) ]; then
sed -i "s/^version: \"\(.*\)\"$/version: \"${{ env.new_version }}\"/" snapcraft.yaml
git add snapcraft.yaml
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git commit -m "Bump version to the latest release candidate (${{ env.new_version }})."
git push
else
echo "New major version (${{ env.new_version }}), please merge the beta branch into the stable one."
fi
check-new-esr:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: esr
- name: Extract current version
run: ./.github/scripts/extract-current-version.sh
- name: Install python deps
run: sudo apt update && sudo apt install python3-lxml python3-packaging
- name: Fetch new version
run: |
version=$(./.github/scripts/check-new-version.py esr ${{ env.current_version }})
echo "new_version=$version" >> $GITHUB_ENV
- name: Update snapcraft.yaml with the new version
if: env.new_version
run: |
if [ $(echo ${{ env.current_version }} | cut -d. -f1) = $(echo ${{ env.new_version }} | cut -d. -f1) ]; then
sed -i "s/^version: \"\(.*\)\"$/version: \"${{ env.new_version }}\"/" snapcraft.yaml
git add snapcraft.yaml
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git commit -m "Bump version to the latest ESR release (${{ env.new_version }})."
git push esr
else
echo "New major version (${{ env.new_version }}), please proceed to a manual update."
fi
check-new-beta:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: beta
- name: Extract current version
run: ./.github/scripts/extract-current-version.sh
- name: Install python deps
run: sudo apt update && sudo apt install python3-lxml python3-packaging
- name: Fetch new version
run: |
version=$(./.github/scripts/check-new-version.py beta ${{ env.current_version }})
echo "new_version=$version" >> $GITHUB_ENV
- name: Update snapcraft.yaml with the new version
if: env.new_version
run: |
sed -i "s/^version: \"\(.*\)\"$/version: \"${{ env.new_version }}\"/" snapcraft.yaml
git add snapcraft.yaml
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git commit -m "Bump version to the latest beta (${{ env.new_version }})."
git push beta
check-new-nightly:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: nightly
- name: Extract current version
run: ./.github/scripts/extract-current-version.sh
- name: Install deps
run: sudo apt update && sudo apt install jq
- name: Fetch new version
run: ./.github/scripts/check-new-nightly.sh ${{ env.current_version }}
- name: Update snapcraft.yaml with the new version
if: env.new_version
run: |
sed -i "s/^version: \"\(.*\)\"$/version: \"${{ env.new_version }}\"/" snapcraft.yaml
git add snapcraft.yaml
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git commit -m "Bump version to the latest nightly (${{ env.new_version }})."
git push