forked from zizhufanqing/kubean
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (79 loc) · 2.98 KB
/
call-os-pkgs-build.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
name: OS Packages Build
on: workflow_call
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: centos7
dockerfile: build/os-packages/Dockerfile.centos7
- name: redhat7
dockerfile: build/os-packages/Dockerfile.redhat7
- name: redhat8
dockerfile: build/os-packages/Dockerfile.redhat8
- name: kylinv10
dockerfile: build/os-packages/Dockerfile.kylinv10
- name: openeuler22.03
dockerfile: build/os-packages/Dockerfile.openeuler22.03
- name: oracle9
dockerfile: build/os-packages/Dockerfile.oracle9
- name: tencent31
dockerfile: build/os-packages/Dockerfile.tencent31
- name: ubuntu1804
dockerfile: build/os-packages/Dockerfile.ubuntu1804
- name: ubuntu2004
dockerfile: build/os-packages/Dockerfile.ubuntu2004
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set env
run: |
ORGANIZATION_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F "/" '{print $1}' | tr '[:upper:]' '[:lower:]')
echo "ORG_NAME=${ORGANIZATION_NAME,,}" >> ${GITHUB_ENV}
- name: Check if the OS package needs to be rebuilt
id: check
env:
OS_NAME: ${{ matrix.name }}
ORG_NAME: ${{ env.ORG_NAME }}
run: |
ret=`bash build/os-packages/check_rebuild_pkgs.sh`
echo "need_rebuild=${ret}" >>$GITHUB_OUTPUT
- name: Set up QEMU
if: ${{ steps.check.outputs.need_rebuild == 'true' }}
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
if: ${{ steps.check.outputs.need_rebuild == 'true' }}
uses: docker/[email protected]
- name: Build OS packages to local
if: ${{ steps.check.outputs.need_rebuild == 'true' }}
uses: docker/[email protected]
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
outputs: type=local,dest=./
- name: Make OS packages into Tar files
if: ${{ steps.check.outputs.need_rebuild == 'true' }}
shell: bash
run: |
mkdir -p os-pkgs/
mv linux_amd64/resources resources
tar -I pigz -cf os-pkgs/os-pkgs-amd64.tar.gz resources --remove-files
mv linux_arm64/resources resources
tar -I pigz -cf os-pkgs/os-pkgs-arm64.tar.gz resources --remove-files
sha256sum os-pkgs/os-pkgs-{amd64,arm64}.tar.gz > os-pkgs/os-pkgs.sha256sum.txt
cp artifacts/import_ospkgs.sh os-pkgs/
tar -I pigz -cf os-pkgs-${{ matrix.name }}-${{ github.ref_name }}.tar.gz os-pkgs/ --remove-files
- name: Release and upload packages
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
generate_release_notes: true
files: |
os-pkgs-${{ matrix.name }}-${{ github.ref_name }}.tar.gz