Repository navigation
98 lines (85 loc) · 3.17 KB
/
Copy pathupdate-libraries.yml
File metadata and controls
98 lines (85 loc) · 3.17 KB
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
name: Update Libraries
on:
schedule:
- cron: "5 4 * * 1"
workflow_dispatch:
permissions:
contents: write
jobs:
update-libraries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: 'false'
- name: Set up Docker
uses: docker/setup-docker-action@v5
with:
daemon-config: |
{
"debug": true,
"features": {
"containerd-snapshotter": true
}
}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Check and build Python libraries
run: ./build_python.sh -i -p 4
- name: Check and build MUSL libraries
run: ./build_musl.sh -p 4
- name: Check and build glibc libraries
run: bash -x ./build_glibc.sh -p 2
- name: Verify Changed files
id: verify-changed-files
run: |
git status --short
# If there are new files exit code will be 0 and 1 if there are no new files
if git status --short | egrep -e '^\?(.*)$' > /dev/null; then
echo "files_changed=true" >> $GITHUB_OUTPUT
else
echo "files_changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "bot@ceems.com"
git config --local user.name "CEEMS Bot"
git add -A
git commit -m "chore: Update Python/MUSL/GLIBC libraries" -s
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
id: push
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
- name: Discord notification
if: steps.verify-changed-files.outputs.files_changed == 'true' || failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
if [ "${{ steps.push.outcome }}" == "success" ]; then
COLOR=5763719
STATUS="Success"
EMOJI=":white_check_mark:"
else
COLOR=15548997
STATUS="Failed"
EMOJI=":x:"
fi
curl -H "Content-Type: application/json" \
-d "{
\"embeds\": [{
\"title\": \"$EMOJI Update Libraries Scheduled Pipeline - $STATUS\",
\"description\": \"Updating MUSL/GLIBC/Python libraries for ebpf package in \`${{ github.repository }}\`\",
\"color\": $COLOR,
\"fields\": [
{\"name\": \"Branch\", \"value\": \"\`${{ github.ref_name }}\`\", \"inline\": true},
{\"name\": \"Commit\", \"value\": \"\`${{ github.sha }}\`\", \"inline\": true},
{\"name\": \"Author\", \"value\": \"${{ github.actor }}\", \"inline\": true}
],
\"url\": \"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"
}]
}" \
$DISCORD_WEBHOOK