forked from canonical/checkbox
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (105 loc) · 4.36 KB
/
checkbox-snap-beta-release.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
name: Beta version of checkbox-snap
run-name: Beta version of checkbox-snap ${{ github.ref_name }}
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
snap:
strategy:
fail-fast: false
matrix:
type: [classic, uc]
releases: [16, 18, 20, 22]
runs-on: ubuntu-latest
env:
SERIES: series_${{ matrix.type }}${{ matrix.releases }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT7_CREDS }}
name: Checkbox snap for series ${{ matrix.type }}${{ matrix.releases }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy over the common files for series ${{ matrix.type }}${{ matrix.releases }}
run: |
cd checkbox-snap/
sudo apt update && sudo apt install -qq -y python3-setuptools-scm
./prepare_${{ matrix.type }}.sh $SERIES
- name: add LP credentials
run: |
mkdir -p ~/.local/share/snapcraft/provider/launchpad/
echo '${{ secrets.LP_CREDS }}' > ~/.local/share/snapcraft/provider/launchpad/credentials
git config --global user.email "[email protected]"
git config --global user.name "Certification bot"
- uses: snapcore/action-build@v1
id: snapcraft
with:
path: checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }}
snapcraft-channel: 7.x/stable
snapcraft-args: remote-build --build-on amd64,arm64,armhf,i386 --launchpad-accept-public-upload
- uses: actions/upload-artifact@v3
if: failure()
with:
name: snapcraft-log-series-${{ matrix.type }}${{ matrix.releases }}
path: |
/home/runner/.cache/snapcraft/log/
/home/runner/.local/state/snapcraft/log/
checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }}/checkbox*.txt
- uses: actions/upload-artifact@v3
with:
name: series_${{ matrix.type }}${{ matrix.releases }}
path: checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }}/*.snap
- name: Check that snapcraft built the expected amount of snaps
run: |
NB_SNAPS=$(find checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }} -maxdepth 1 -type f -name *.snap | wc -l)
# Expecting 3 snaps for 20 and 22 releases (amd64, armhf, arm64)
# and 4 snaps for 16 and 18 releases (i386, amd64, armhf, arm64)
if [ ${{ matrix.releases }} == "16" ] || [ ${{ matrix.releases }} == "18" ]
then
if [ ${NB_SNAPS} != "4" ]
then
echo "Error: Snapcraft should have produced 4 snaps, found ${NB_SNAPS} instead."
exit 1
fi
else
if [ ${NB_SNAPS} != "3" ]
then
echo "Error: Snapcraft should have produced 3 snaps, found ${NB_SNAPS} instead."
exit 1
fi
fi
- name: Upload checkbox snaps to the store
run: |
for snap in checkbox-snap/series_${{ matrix.type }}${{ matrix.releases }}/*.snap
do
echo "Uploading $snap..."
if [[ ${{ matrix.type }} == 'classic' ]]; then
if [[ ${{ matrix.releases }} == '22' ]]; then
snapcraft upload $snap --release ${{ matrix.releases }}.04/beta,latest/beta
else
snapcraft upload $snap --release ${{ matrix.releases }}.04/beta
fi
else
snapcraft upload $snap --release ${{ matrix.type }}${{ matrix.releases }}/beta
fi
done
changelog:
runs-on: ubuntu-latest
name: checkbox-snap changelog (${{ github.ref_name }})
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create changelog
run: |
git config --global user.email "[email protected]"
git config --global user.name "Devices Certification Bot"
echo 'checkbox-snap (${{ github.ref_name }}):' > changelog
git log --no-merges --pretty='format:+ %s' $(git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/tags/checkbox-snap-v* | tail -n 2 | head -n 1)...${{ github.ref_name }} -- ':checkbox-snap' >> changelog
- name: Archive changelog
uses: actions/upload-artifact@v3
with:
name: Changelog
path: changelog