-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (57 loc) · 1.88 KB
/
make-rpms.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
name: Make RPMs
on:
push:
branches:
- master
- main
pull_request:
jobs:
make-rpm:
runs-on: ubuntu-22.04
env:
dest_id: core
docker_image: ghcr.io/nethserver/makerpms:7
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Generate .env file
run: |
cat > .env <<EOF
DEST_ID=${{ env.dest_id }}
NSVER=7
DOCKER_IMAGE=${{ env.docker_image }}
GITHUB_ACTIONS=1
GITHUB_HEAD_REF=${{ github.head_ref }}
GITHUB_REF=${{ github.ref }}
GITHUB_REPOSITORY=${{ github.repository }}
GITHUB_RUN_ID=${{ github.run_id }}
ENDPOINTS_PACK=${{ secrets.endpoints_pack }}
SECRET=${{ secrets.secret }}
SECRET_URL=${{ secrets.secret_url }}
AUTOBUILD_SECRET=${{ secrets.autobuild_secret }}
AUTOBUILD_SECRET_URL=${{ secrets.autobuild_secret_url }}
EOF
- name: Run prep-sources if present.
run: if test -f "prep-sources"; then ./prep-sources; fi
- name: Build RPM and publish
run: |
echo "Starting build..."
docker run --name makerpms \
--env-file .env \
--hostname $GITHUB_RUN_ID-$GITHUB_RUN_NUMBER.nethserver.org \
--volume $PWD:/srv/makerpms/src:ro \
${{ env.docker_image }} \
makerpms-github -s *.spec
echo "Build succesful."
if [[ "${{ secrets.endpoints_pack }}" && "${{ secrets.secret }}" ]]; then
echo "Publish configuration exists, pushing package to repo."
docker commit makerpms nethserver/build
docker run \
--env-file .env \
nethserver/build \
uploadrpms-github
echo "Publish complete."
fi
rm .env