-
Notifications
You must be signed in to change notification settings - Fork 46
/
action.yaml
117 lines (116 loc) · 3.5 KB
/
action.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
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
name: rbuild
description: Radxa Image Builder
inputs:
board:
required: true
distro:
required: false
suite:
required: false
flavor:
required: true
artifacts:
required: false
default: false
release-id:
required: false
github-token:
required: false
prebuilt-rootfs:
required: false
default: false
test-repo:
required: false
default: false
timestamp:
required: false
default: b${{ github.run_number }}
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: radxa-repo/rbuild
- name: Set suite based on input variables
shell: bash
run: |
if [[ -n "${{ inputs.suite }}" ]]
then
echo "suite=${{ inputs.suite }}" >> $GITHUB_ENV
elif [[ "${{ inputs.distro }}" == "debian" ]]
then
suite="bullseye"
echo "Distro set to ${{ inputs.distro }}, using $suite as suite"
echo "suite=$suite" >> $GITHUB_ENV
elif [[ "${{ inputs.distro }}" == "ubuntu" ]]
then
suite="jammy"
echo "Distro set to ${{ inputs.distro }}, using $suite as suite"
echo "suite=$suite" >> $GITHUB_ENV
else
echo "Unknown distro/suite value!" >&2
exit 1
fi
options=()
if [[ "${{ inputs.test-repo }}" == "true" ]]
then
options+=("--test-repo")
fi
echo "options=${options[*]}" >> $GITHUB_ENV
- name: Install dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y debos
- name: Fetch prebuilt rootfs
if: inputs.prebuilt-rootfs == 'true'
uses: actions/download-artifact@v4
with:
name: rootfs_${{ env.suite }}_${{ inputs.flavor }}
path: .rootfs
- name: Build
shell: bash
run: |
mkdir .output
cd .output
sudo ../rbuild ${{ env.options }} --timestamp=${{ inputs.timestamp}} --compress --native-build --shrink ${{ inputs.board }} ${{ env.suite }} ${{ inputs.flavor }}
if [ -n "$(ls -A ./* 2>/dev/null)" ]
then
sudo chown $USER ./*
fi
- name: Upload image artifacts
if: inputs.artifacts == 'true' && inputs.board != 'rootfs'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.board }}_${{ env.suite }}_${{ inputs.flavor }}
path: .output
- name: Upload rootfs artifacts
if: inputs.artifacts == 'true' && inputs.board == 'rootfs'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.board }}_${{ env.suite }}_${{ inputs.flavor }}
path: .rootfs
- name: Upload image
if: inputs.release-id != '' && inputs.github-token != '' && inputs.board != 'rootfs'
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
with:
release_id: ${{ inputs.release-id }}
file: .output/*
- name: Upload rootfs
if: inputs.release-id != '' && inputs.github-token != '' && inputs.board == 'rootfs'
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
with:
release_id: ${{ inputs.release-id }}
file: .rootfs/*
- name: Rollback release
if: failure() && inputs.release-id != '' && inputs.github-token != ''
uses: author/action-rollback@stable
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
with:
release_id: ${{ inputs.release-id }}