-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (124 loc) · 4.53 KB
/
update.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
concurrency:
cancel-in-progress: true
group: "${{ github.workflow }}-${{ github.ref }}"
jobs:
update:
permissions:
contents: "write"
id-token: "write"
pages: "write"
runs-on: "ubuntu-latest"
steps:
- env:
SECRETS: "${{ toJSON(secrets) }}"
name: "Secret tests"
uses: "actions/github-script@v7"
with:
script: |
const secrets = JSON.parse(process.env.SECRETS);
if (secrets.GPG_KEY === undefined || secrets.RADXA_APT_KEY_2024 === undefined) {
core.setFailed('Required secrets are unset!');
}
- name: "Checkout rsdk"
uses: "actions/checkout@v4"
with:
ref: "476c013766033e231cff35d10717ceed5edf43e3"
repository: "RadxaOS-SDK/rsdk"
- name: "Checkout current repo"
uses: "actions/checkout@v4"
with:
path: ".infra-repo"
- env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
id: "build"
name: "Build apt archive"
run: |
# ubuntu-latest is currently ubuntu-22.04, which provides aptly 1.4.0
# Only 1.5.0 supports Ubuntu's zstd compressed packages:
# https://github.com/aptly-dev/aptly/pull/1050
# ubuntu-24.04 provides 1.5.0, but will not be available till August:
# https://github.com/actions/runner-images/issues/9691#issuecomment-2063926929
# Install aptly from upstream archive for now.
sudo tee /etc/apt/sources.list.d/10-aptly.list <<< "deb http://repo.aptly.info/ squeeze main"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EE727D4449467F0E
sudo apt-get update
sudo apt-get install -y aptly pandoc
# Workaround https://github.com/aptly-dev/aptly/issues/1297
git clone -b 1297-hack https://github.com/RadxaOS-SDK/aptly.git /tmp/aptly
export PATH="$HOME/go/bin:$PATH"
pushd /tmp/aptly
make release
popd
APTLY_PATH=/tmp/aptly/xc-out/*/linux_amd64
export PATH="$APTLY_PATH:$PATH"
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
cat << EOF | gpg --import
${{ secrets.GPG_KEY }}
EOF
cat << EOF | gpg --import
${{ secrets.RADXA_APT_KEY_2024 }}
EOF
suites=(
"rk3582-bookworm-test"
)
pushd .infra-repo
if [[ "${{ github.repository }}" != *-test ]] && \
wget "https://raw.githubusercontent.com/${{ github.repository }}-test/main/pkgs.lock" -O pkgs.lock.new; then
mv pkgs.lock.new pkgs.lock
git add pkgs.lock
fi
../src/bin/rsdk infra-pkg-snapshot
../src/bin/rsdk infra-pkg-download --no-default-distro "${suites[@]}"
../src/bin/rsdk infra-repo-sync --origin "${suites[0]}" --label "${suites[0]}" "${suites[@]}"
export RSDK_REPO_ORIGIN="${suites[0]}"
git add pkgs.json
pushd "$HOME/.aptly/public/$RSDK_REPO_ORIGIN/"
cp "$OLDPWD/pkgs.json" ./
pandoc --from gfm --to html --standalone "$OLDPWD/README.md" --output index.html
find . > files.list
echo "pages=$(realpath .)" >> $GITHUB_OUTPUT
popd
if [[ -n "$(git status --porcelain)" ]]; then
git commit -m "chore: update package snapshot"
fi
popd
shell: "bash"
- name: "Setup GitHub Pages"
uses: "actions/configure-pages@v5"
- name: "Upload artifact"
uses: "actions/upload-pages-artifact@v3"
with:
path: "${{ steps.build.outputs.pages }}"
- id: "deploy"
if: "github.event_name != 'pull_request'"
name: "Deploy to GitHub Pages"
uses: "actions/deploy-pages@v4"
- if: "steps.deploy.outcome == 'success'"
name: "Commit package snapshot"
run: |
pushd .infra-repo
git push
popd
shell: "bash"
- name: "Download Pages artifact"
uses: "actions/download-artifact@v4"
with:
name: "github-pages"
- if: "steps.deploy.outcome == 'success'"
name: "Release Pages artifact"
uses: "softprops/action-gh-release@v2"
with:
body: "Rolling Pages artifact"
draft: false
files: "artifact.tar"
prerelease: false
tag_name: "github-pages"
token: "${{ secrets.GITHUB_TOKEN }}"
name: "Update packages"
"on":
repository_dispatch:
types:
- "new_package_release"
workflow_dispatch: {}
permissions: {}