-
Notifications
You must be signed in to change notification settings - Fork 39
91 lines (89 loc) · 2.59 KB
/
build-ci.yaml
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
name: build-ci
on:
schedule:
- cron: 0 22 * * *
push:
branches:
- main
pull_request:
jobs:
build-all-artifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Export tag
id: export_tag
run: |
git describe --abbrev=0 --tags
TAG=`git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0"`
echo "elemental_tag=$TAG" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y genisoimage
- name: Build image
run: |
make build
make dump_image
- name: Build iso
run: |
make iso
- name: Cache artifacts
uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: build/*
key: build-ci-${{ github.event.pull_request.head.sha || github.sha }}
- name: Send failed status to slack (only on schedule)
if: failure() && github.event_name == 'schedule'
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Workflow build-ci ${{ github.job }}"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": ":github:",
"emoji": true
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
upload-all-artifacts:
needs: build-all-artifacts
runs-on: ubuntu-latest
steps:
- name: Restore cache artifacts
uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: build/*
key: build-ci-${{ github.event.pull_request.head.sha || github.sha }}
- name: Upload docker image
uses: actions/upload-artifact@v3
with:
name: docker-image
path: build/*.tar
- name: Upload ISO
uses: actions/upload-artifact@v3
with:
name: iso-image
path: build/*.iso