This repository has been archived by the owner on Oct 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 453
94 lines (80 loc) · 2.51 KB
/
update-branches.yml
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
name: Update Branches
# we only want to run this job manually via button pushing
on:
workflow_dispatch:
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
env:
TZ: UTC
concurrency:
group: update-branches
cancel-in-progress: true
jobs:
generate:
name: Generate Matrix
runs-on: ubuntu-latest
outputs:
arches: ${{ steps.generate.outputs.arches }}
steps:
- uses: actions/checkout@v2
- id: generate
name: Generate
run: |
arches="$(jq -Rsc 'rtrimstr("\n") | split("\n") | unique' */arches)"
echo "::set-output name=arches::$arches"
arch:
needs: generate
strategy:
matrix:
arch: ${{ fromJSON(needs.generate.outputs.arches) }}
name: Update ${{ matrix.arch }}
runs-on: ubuntu-latest
env:
dpkgArch: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
- name: Prep
id: prep
run: |
case "$dpkgArch" in
amd64 | i386 | riscv64 | s390x) bashbrewArch="$dpkgArch" ;;
armhf) bashbrewArch='arm32v7' ;;
arm64) bashbrewArch='arm64v8' ;;
ppc64el) bashbrewArch='ppc64le' ;;
*) echo >&2 "error: unexpected / unsupported architecture: '$dpkgArch'"; exit 1 ;;
esac
echo "::set-output name=bashbrewArch::$bashbrewArch"
echo "bashbrewArch=$bashbrewArch" >> "$GITHUB_ENV"
git config user.name 'Docker Library Bot'
git config user.email '[email protected]'
- name: Download Artifacts
run: |
echo "$dpkgArch" > arch
./update.sh
- name: Commit
run: |
git add arch
for dir in */; do
dir="${dir%/}"
if [ ! -f "$dir/Dockerfile" ]; then
rm -rf "$dir"
fi
git add -A "$dir"
done
latestSerial="$(
gawk -F '=' '$1 == "SERIAL" { print $2 }' */build-info.txt \
| sort -un \
| tail -1
)"
latestDate="${latestSerial%%[^0-9]*}"
rfc2822="$(date --date "$latestDate" --rfc-2822)"
export GIT_AUTHOR_DATE="$rfc2822"
export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
git commit --message "Update to $latestSerial for $bashbrewArch ($dpkgArch)"
- name: Push
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: dist-${{ steps.prep.outputs.bashbrewArch }}
force: true