-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (120 loc) · 5.02 KB
/
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
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
134
135
136
name: Build
on:
workflow_dispatch:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:latest-${{ matrix.config.bootstrap }}'
env:
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.bootstrap }}'
# TEST: '${{ matrix.config.test }}'
HOSTREPO: /hostrepo
REPOSITORY: '${{ github.repository }}'
BRANCH: '${{ github.ref_name }}'
REF: '${{ github.ref }}'
strategy:
fail-fast: false
matrix:
config:
- { arch: x86_64, bootstrap: x86_64, test: 1 }
# - { arch: i686, bootstrap: i686, test: 1 }
# - { arch: aarch64, bootstrap: x86_64, test: 0 }
# - { arch: armv7l, bootstrap: x86_64, test: 0 }
# - { arch: x86_64-musl, bootstrap: x86_64-musl, test: 1 }
# - { arch: armv6l-musl, bootstrap: x86_64-musl, test: 0 }
# - { arch: aarch64-musl, bootstrap: x86_64-musl, test: 0 }
steps:
- name: Prepare container
run: |
xbps-install -Syu || xbps-install -yu xbps
xbps-install -yu
xbps-install -y bash git libstdc++ tar wget ${{ env.ACT && 'nodejs' }}
echo "HOME=$HOME" >> $GITHUB_ENV
# Non x86_64: https://github.com/actions/checkout/issues/334
- uses: actions/checkout@v3
with:
repository: void-linux/void-packages
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
run: |
ln -s "$(pwd)" /hostrepo \
&& common/travis/set_mirror.sh \
&& common/travis/prepare.sh \
&& git config --global --add safe.directory "$(pwd)" \
&& common/travis/fetch-xtools.sh
echo; echo "===== Checking out xpackages repository ====="
wget "$GITHUB_SERVER_URL/$REPOSITORY/archive/$REF.tar.gz"
tar -xzvf "${BRANCH:-$(basename $REF)}.tar.gz" --strip-components=1 -C srcpkgs
echo; echo "===== Changed Templates ====="
git add .
git diff-index -r --no-renames --name-only --diff-filter=AM --cached HEAD \
-- 'srcpkgs/*/template' \
| cut -d/ -f 2 \
| tee /tmp/templates \
| sed "s/^/ /" >&2
- name: Build (xbps-src)
run: |
here="$(pwd)"
cd /
echo; echo "===== Building Packages ====="
"$here/common/travis/build.sh" "$BOOTSTRAP" "$ARCH" "$TEST"
cd -
- name: Metadata and Verification (void-packages/scripts)
run: |
here="$(pwd)"
cd /
echo; echo "===== Displaying Files ====="
"$here/common/travis/show_files.sh" "$BOOTSTRAP" "$ARCH"
echo; echo "===== Displaying Diffs ====="
"$here/common/travis/xpkgdiff.sh" "$BOOTSTRAP" "$ARCH"
echo; echo "===== Checking installation ====="
"$here/common/travis/check-install.sh" "$BOOTSTRAP" "$ARCH"
cd -
- name: Sign repository
run: |
echo "${{ secrets.SIGNING_RSA_KEY }}" > private.pem
xbps-rindex --privkey private.pem --sign --signedby "Animesh Sahu" $HOME/hostdir/binpkgs
xbps-rindex --privkey private.pem --sign-pkg $HOME/hostdir/binpkgs/*.xbps
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: binpkg-${{ matrix.config.ARCH }}
path: ${{ env.HOME }}/hostdir/binpkgs
retention-days: 1
post_build:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Flatten the artifacts hierarchy
run: |
rsync -avh --remove-source-files binpkg-*/ ./
find ./ -type d -empty -delete
- name: Deploy Binaries
env:
NETLIFY_LFS: https://fbd39825-00be-4c1a-9eec-3e33af6cd078.netlify.app/.netlify/large-media
run: |
export SHELL=/bin/bash
sudo apt-get update -y && sudo apt-get install -y git git-lfs nodejs npm
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git init . -b binaries
git lfs install
git lfs track '*.xbps'
git config "lfs.$NETLIFY_LFS.locksverify" false
npm i -g netlify-cli
mkdir -p $HOME/.config/netlify
printf '%s\n' '[lfs]' " url = $NETLIFY_LFS" > .lfsconfig
printf '%s\n' '${{ secrets.NETLIFY_CONFIG }}' > $HOME/.config/netlify/config.json
netlify lm:install --force || true
source /home/runner/.config/netlify/helper/path.$(basename "$SHELL").inc
git add .
git commit --no-verify --signoff --author "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" -m "Deploy XBPS Binaries"
git push -fu "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" HEAD:binaries --atomic