-
Notifications
You must be signed in to change notification settings - Fork 2
163 lines (142 loc) · 5.08 KB
/
build.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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Build Image
on:
push:
branches:
- devel
tags:
- testing-v[0-9]+.*
- v[0-9]+.*
workflow_dispatch:
inputs:
release:
description: 'Release type'
type: choice
required: true
options:
- release
- testing
- unstable
env:
VERSION: v0.15.0-${{ github.run_number }}
yagna_tag: ^v*
ya-runtime-wasi_tag: pre-rel-v0.2.4
ya-installer-resources_tag: ^v.*
ya-runtime-vm_tag: ^pre-rel-v0.4.0-ITL-.*
ya-runtime-vm-nvidia_tag: ^pre-rel-v0.1.3-.*
golem-nvidia-kernel_tag: ^v.*
apt-sub-repo: apt-repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
upload-repo:
name: "Fetch packages and build repository"
runs-on: ubuntu-22.04
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- uses: actions/checkout@v4
- name: 'set release type'
run: |
./version.sh "${{ github.event.inputs.release }}" "${{ github.ref }}" >> $GITHUB_ENV
- name: "Get deb package: yagna"
uses: ./.github/actions/fetch-release-deb
with:
repo: yagna
pattern: ${{ env.yagna_tag }}
prerelease: false
- name: "Get deb package: ya-runtime-wasi"
uses: ./.github/actions/fetch-release-deb
with:
repo: ya-runtime-wasi
pattern: ${{ env.ya-runtime-wasi_tag }}
prerelease: true
- name: "Get deb package: ya-installer-resources"
uses: ./.github/actions/fetch-release-deb
with:
repo: ya-installer-resources
pattern: ${{ env.ya-installer-resources_tag }}
prerelease: true
- name: "Get deb package: ya-runtime-vm"
uses: ./.github/actions/fetch-release-deb
with:
repo: ya-runtime-vm
pattern: ${{ env.ya-runtime-vm_tag }}
prerelease: true
- name: "Get deb package: ya-runtime-vm-nvidia"
uses: ./.github/actions/fetch-release-deb
with:
owner: golemfactory
repo: ya-runtime-vm-nvidia
pattern: ${{ env.ya-runtime-vm-nvidia_tag }}
prerelease: true
- name: "Get deb package: golem-nvidia-kernel"
uses: ./.github/actions/fetch-release-deb
with:
owner: golemfactory
repo: golem-nvidia-kernel
pattern: ${{ env.golem-nvidia-kernel_tag }}
prerelease: true
- name: Import GPG key
id: gpg_key
env:
GPG_KEY: ${{ secrets.APT_GPG_KEY }}
run: |
echo "$GPG_KEY" | gpg --batch --import
printf "keyid=%s\n" $(gpg -K --with-colons |grep ^fpr|cut -f 10 -d :) >> "$GITHUB_OUTPUT"
- name: Create repository
run: |
TARGET_DIR="./${{ env.apt-sub-repo }}/${{ env.DIST_TYPE }}"
mkdir -p "$TARGET_DIR"
sudo apt-get -qy install reprepro
./update-local-repository.sh ./packages $TARGET_DIR ubuntu jammy ${{ steps.gpg_key.outputs.keyid }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Commit new packages to golem-apt-repository
run: |
cd "./${{ env.apt-sub-repo }}"
aws s3 sync "${{ env.DIST_TYPE }}/" "s3://repo-golem-gpu-live/${{ env.DIST_TYPE }}/"
- name: Upload repository artifact
uses: actions/upload-pages-artifact@v2
if: env.DIST_TYPE == 'release'
with:
path: ${{ env.apt-sub-repo }}/${{ env.DIST_TYPE }}
- name: Deploy to GitHub Pages
if: env.DIST_TYPE == 'release'
id: deployment
uses: actions/deploy-pages@v2
build:
name: Building Image ${{ github.ref }}
runs-on: ubuntu-22.04
needs:
- upload-repo
steps:
- uses: actions/checkout@v4
- name: 'set release type'
run: |
./version.sh "${{ github.event.inputs.release }}" "${{ github.ref }}" >> $GITHUB_ENV
- run: |
sudo apt install \
debootstrap squashfs-tools xorriso isolinux \
syslinux-efi grub-pc-bin grub-efi-amd64-bin \
grub-efi-ia32-bin mtools dosfstools \
jq rsync
- run: |
BUILD_ARGS="--build-arg APT_REPO=https://gpu-live.cdn.golem.network/${DIST_TYPE}" make root image
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Sending image to S3
run: |
set -x
ls -al work/
ls -alh work/golem-gpu-live-${VERSION}.img
sudo xz work/golem-gpu-live-${VERSION}.img
sudo chown $USER work/* work
aws s3 cp work/golem-gpu-live-${VERSION}.img.xz s3://repo-golem-gpu-live/images/golem-gpu-live-${DIST_TYPE}-${VERSION}.img.xz