forked from WLAN-Pi/pi-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (109 loc) · 3.65 KB
/
build-image.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
122
123
124
125
126
name: Build image
on:
# Allow manual runs of workflow from Actions tab
workflow_dispatch:
inputs:
version-bump:
description: Version bump
required: true
type: choice
options:
- Auto
- Major
- Minor
- Patch
- RC
- Dev
- Release
default: Auto
# schedule:
# - cron: '37 5 * * *'
push:
branches:
- force-build
- rg-dev
jobs:
build:
runs-on: "${{ vars.RUNS_ON || 'ubuntu-22.04' }}"
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Build image
id: build-image
run: |
last_commit_date=$(git log -1 --format=%cd --date=unix)
last_day=$(date -d '-1 day' +%s)
if [ "${last_commit_date}" -lt "${last_day}" ]; then
echo "Nothig new to build."
echo "Last commit:"
git log -1 --format='%C(auto)%h (%cd) - %s' --date=relative
exit 0
fi
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
sudo ./build-docker.sh -v ${{ github.event.inputs.version-bump }}
- name: Generate checksum
id: generate-checksum
run: |
cd deploy; for file in *.zip; do echo $(sha256sum --binary $file) > "${file}.sha256"; done; cd ../
- name: Upload image
uses: actions/upload-artifact@v3
with:
name: wlanpi-nightly-release-${{ steps.build-image.outputs.version }}
path: deploy/*.zip
- name: Upload image checksum
uses: actions/upload-artifact@v3
with:
name: wlanpi-nightly-release-${{ steps.build-image.outputs.version }}-sha256
path: deploy/*.sha256
- name: Upload image info
uses: actions/upload-artifact@v3
with:
name: wlanpi-nightly-release-${{ steps.build-image.outputs.version }}-info
path: deploy/*.info
- name: Create Pre-Release
if: ${{ github.event.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ steps.build-image.outputs.version }}
prerelease: true
files: |
deploy/*.zip
deploy/*.info
deploy/wlanpi-os/os.json
- name: Upload logs
if: always()
uses: actions/upload-artifact@v3
with:
name: wlanpi-nightly-release-${{ steps.build-image.outputs.version }}-buildlogs
path: deploy/*.log
slack-workflow-status:
if: ${{ always() && (vars.SKIP_SLACK != 'true') }}
name: Post Workflow Status to Slack
needs:
- build
runs-on: "${{ vars.RUNS_ON || 'ubuntu-22.04' }}"
steps:
- name: Slack Workflow Notification
uses: Gamesight/slack-workflow-status@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
channel: '#pi-gen'
name: 'WLAN Pi CI Bot'